From 8230e268a8f712c3b1a08b9f8ac5cd1bc3b0de03 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 14:40:43 +0900 Subject: [PATCH 1/6] feat(core): single language vocabulary + evidence-based TECH_STACK_MISMATCH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three divergent language tables meant clad init could seed a label the detector layer then rejected under --strict — measured on realistic repo shapes, the manifest-chain comparison blocked 12 of 19 normal projects (Android C++ SDK under Gradle, Rust core shipped via npm, plain JavaScript, C#, Scala). The vocabulary now lives once in src/core/language-evidence.ts, and the detector judges the observed source distribution instead of the build manifest: unknown language or under 5 classified files → silence, declared absent → one warn naming the evidence, minority under 10% → one non-blocking info. A coverage-ratio rule is deliberately absent — red-teaming showed its denominator list flipped failures between false-warn and missed-drift depending on membership. detectToolchain is untouched: a build-host label answers "what do we run", which stays the right question for gate-command selection. Verified: 22-test impl-blind oracle (authored from the contract only), 32-shape adversarial corpus vs an independent reference (0 mismatches, 0 blocked false positives, 0 missed drifts), strict blocking semantics proven through the built CLI, full suite 2886/2886. F-9e1279d4 · clad done under a GREEN strict pre-push gate Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- docs/ab-evaluation/case-payment-saas.md | 10 +- plugins/claude-code/dist/clad.js | 772 +++++++++--------- spec.yaml | 4 +- spec/attestation.yaml | 26 +- .../language-evidence-core-9e1279d4.yaml | 70 ++ spec/index.yaml | 1 + src/cli/scan/thresholds.ts | 29 +- src/core/language-evidence.ts | 168 ++++ src/stages/detectors/tech-stack-mismatch.ts | 119 ++- src/ui/softShell.ts | 2 +- tests/core/language-evidence.test.ts | 142 ++++ .../tech-stack-mismatch-evidence.test.ts | 319 ++++++++ tests/stages/tech-stack-mismatch.test.ts | 173 +++- 19 files changed, 1374 insertions(+), 485 deletions(-) create mode 100644 spec/features/language-evidence-core-9e1279d4.yaml create mode 100644 src/core/language-evidence.ts create mode 100644 tests/core/language-evidence.test.ts create mode 100644 tests/stages/tech-stack-mismatch-evidence.test.ts diff --git a/README.html b/README.html index e26c2384..7c5e13e5 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
+
2886/2886
all pass
diff --git a/README.ja.md b/README.ja.md index a1896446..205fc350 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) | 2886 / 2886 | 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..63923819 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
+
2886/2886
all pass
diff --git a/README.ko.md b/README.ko.md index 1ce9db49..7ffc2d7e 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) | 2886 / 2886 · 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..dd494d0e 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) | 2886 / 2886 | 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..0f9ba050 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) | 2886 / 2886 | 15 阶段 · 41 检测器 | 277(273 done) | 253 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/ab-evaluation/case-payment-saas.md b/docs/ab-evaluation/case-payment-saas.md index 6c64f936..01122958 100644 --- a/docs/ab-evaluation/case-payment-saas.md +++ b/docs/ab-evaluation/case-payment-saas.md @@ -41,7 +41,7 @@ no spec, no scenarios, no architecture invariants. | Forbidden-import rules | 2 | 0 | +2 | | Detector errors | 0 | 1 | -1 | | Detector warnings | 1 | 3 | -2 | -| Detector infos | 13 | 28 | -15 | +| Detector infos | 12 | 28 | -16 | | Tiered doc files | 2 | 0 | +2 | | Tiered docs (lines) | 61 | 0 | +61 | | Other doc files | 0 | 1 | -1 | @@ -56,7 +56,7 @@ no spec, no scenarios, no architecture invariants. **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): ``` -A (Cladding) — errors: 0 warns: 1 infos: 13 +A (Cladding) — errors: 0 warns: 1 infos: 12 B (Vanilla) — errors: 1 warns: 3 infos: 28 Sample errors: @@ -80,7 +80,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 | Forbidden-import rules | 2 | 0 | +2 | | Detector errors | 1 | 1 | +0 | | Detector warnings | 3 | 3 | +0 | -| Detector infos | 15 | 28 | -13 | +| Detector infos | 14 | 28 | -14 | | Tiered doc files | 2 | 0 | +2 | | Tiered docs (lines) | 61 | 0 | +61 | | Other doc files | 0 | 1 | -1 | @@ -95,7 +95,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 **Detector outcomes** (META_INTEGRITY + HARDCODED_SECRET excluded — toolchain-only checks): ``` -A (Cladding) — errors: 1 warns: 3 infos: 15 +A (Cladding) — errors: 1 warns: 3 infos: 14 Sample errors: - [AC_DRIFT] F-4db939.AC-002 EARS: ears='unwanted' requires condition starting with 'if' — empty @@ -109,7 +109,7 @@ B (Vanilla) — errors: 1 warns: 3 infos: 28 - **Structured artifacts**: cladding produces 9 tier-banner-bearing files vs vanilla's 0. - **Spec ↔ code traceability**: cladding emits 1 feature(s), 2 AC(s), 2 scenario(s), 3 capability(s); vanilla has 0 of each. - **Architecture enforcement**: cladding declares 3 layer(s) with 2 forbidden-import rule(s); vanilla has 0. -- **Detector behavior**: cladding-managed tree → 1 error(s) / 3 warn(s) / 15 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. +- **Detector behavior**: cladding-managed tree → 1 error(s) / 3 warn(s) / 14 info(s). Vanilla tree → 1 / 3 / 28. The detectors that gate against spec (REFERENCE_INTEGRITY, MISSING_IMPLEMENTATION, ARCHITECTURE_FROM_SPEC, CAPABILITIES_FEATURE_MAPPING) need cladding's artifacts to evaluate — without them they silently pass. The "0 errors on vanilla" therefore is **absence of signal**, not absence of drift. - **Token cost**: cladding's cumulative artifact + code consumes ~1943 tokens vs vanilla's ~1399 (heuristic chars/4) — Δ ≈ 544 tokens, the price of structure. - **Code surface**: vanilla writes 5 source file(s) / 126 LoC + 2 test file(s) / 4 test case(s); cladding writes 1 / 11 + 1 / 1. (Vanilla front-loads code, cladding front-loads spec — both converge by M2.) diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 24438a5f..4e3886f7 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ 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(` -`)}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 utypeof 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)FA(t,r,{get:e[r],enumerable:!0})},Rfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Afe(e))!Ofe.call(t,i)&&i!==r&&FA(t,i,{get:()=>e[i],enumerable:!(n=Efe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?kfe(Tfe(t)):{},Rfe(e||!t||!t.__esModule?FA(r,"default",{value:t,enumerable:!0}):r,t));var df=v(zA=>{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}},LA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};zA.CommanderError=Ty;zA.InvalidArgumentError=LA});var Oy=v(qA=>{var{InvalidArgumentError:Ife}=df(),UA=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 Ife(`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 Pfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}qA.Argument=UA;qA.humanReadableArgName=Pfe});var GA=v(BA=>{var{humanReadableArgName:Cfe}=Oy(),HA=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=>Cfe(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 P4(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 P4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}BA.Help=HA;BA.stripColor=P4});var KA=v(WA=>{var{InvalidArgumentError:Dfe}=df(),ZA=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=Nfe(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 Dfe(`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?C4(this.name().replace(/^no-/,"")):C4(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}},VA=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 C4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Nfe(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} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}VA.Option=GA;VA.DualOptions=ZA});var I4=v(R4=>{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?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}WA.Option=ZA;WA.DualOptions=VA});var N4=v(D4=>{function jfe(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 Mfe(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=jfe(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 -- 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 +(Did you mean ${n[0]}?)`:""}D4.suggestSimilar=Mfe});var L4=v(eT=>{var Ffe=Ge("node:events").EventEmitter,JA=Ge("node:child_process"),mo=Ge("node:path"),Ry=Ge("node:fs"),He=Ge("node:process"),{Argument:Lfe,humanReadableArgName:zfe}=Oy(),{CommanderError:YA}=df(),{Help:Ufe,stripColor:qfe}=GA(),{Option:j4,DualOptions:Hfe}=KA(),{suggestSimilar:M4}=N4(),XA=class t extends Ffe{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:()=>QA()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>QA()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>qfe(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 Ufe,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 Lfe(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 YA(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 j4(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 j4)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(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=F4(He.execArgv).concat(r),c=JA.spawn(He.argv[0],r,{stdio:"inherit"})):c=JA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=F4(He.execArgv).concat(r),c=JA.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 YA(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 YA(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. +`),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 Hfe(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=M4(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=M4(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=>zfe(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(` -`)?fT(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function F4(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 QA(){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}eT.Command=XA;eT.useColor=QA});var H4=v(On=>{var{Argument:z4}=Oy(),{Command:tT}=L4(),{CommanderError:Bfe,InvalidArgumentError:U4}=df(),{Help:Gfe}=GA(),{Option:q4}=KA();On.program=new tT;On.createCommand=t=>new tT(t);On.createOption=(t,e)=>new q4(t,e);On.createArgument=(t,e)=>new z4(t,e);On.Command=tT;On.Option=q4;On.Argument=z4;On.Help=Gfe;On.CommanderError=Bfe;On.InvalidArgumentError=U4;On.InvalidOptionArgumentError=U4});var De=v(er=>{"use strict";var nT=Symbol.for("yaml.alias"),V4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),W4=Symbol.for("yaml.pair"),iT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),Yfe=t=>!!t&&typeof t=="object"&&t[ho]===nT,Xfe=t=>!!t&&typeof t=="object"&&t[ho]===V4,Qfe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,epe=t=>!!t&&typeof t=="object"&&t[ho]===W4,K4=t=>!!t&&typeof t=="object"&&t[ho]===iT,tpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function J4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function rpe(t){if(t&&typeof t=="object")switch(t[ho]){case nT:case Iy:case iT:case Py:return!0}return!1}var npe=t=>(K4(t)||J4(t))&&!!t.anchor;er.ALIAS=nT;er.DOC=V4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=W4;er.SCALAR=iT;er.SEQ=Py;er.hasAnchor=npe;er.isAlias=Yfe;er.isCollection=J4;er.isDocument=Xfe;er.isMap=Qfe;er.isNode=rpe;er.isPair=epe;er.isScalar=K4;er.isSeq=tpe});var ff=v(oT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),Y4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=X4(e);Ut.isDocument(t)?rl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):rl(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=Y4;Cy.REMOVE=Ti;function rl(t,e,r,n){let i=Q4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return eH(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 tH=De(),ipe=ff(),ope={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},spe=t=>t.replace(/[!,[\]{}]/g,e=>ope[e]),pf=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+spe(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&&tH.isNode(e.contents)){let o={};ipe.visit(e.contents,(s,a)=>{tH.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(` +`)}};pf.defaultYaml={explicit:!1,version:"1.2"};pf.defaultTags={"!!":"tag:yaml.org,2002:"};rH.Directives=pf});var Ny=v(mf=>{"use strict";var nH=De(),ape=ff();function cpe(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 iH(t){let e=new Set;return ape.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function oH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function lpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=iH(t));let s=oH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(nH.isScalar(s.node)||nH.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}}mf.anchorIsValid=cpe;mf.anchorNames=iH;mf.createNodeAnchors=lpe;mf.findNewAnchor=oH});var aT=v(sH=>{"use strict";function hf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var upe=De();function aH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>aH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!upe.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}cH.toJS=aH});var jy=v(uH=>{"use strict";var dpe=aT(),lH=De(),fpe=Wo(),cT=class{constructor(e){Object.defineProperty(this,lH.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(!lH.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=fpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?dpe.applyReviver(o,{"":a},"",a):a}};uH.NodeBase=cT});var gf=v(dH=>{"use strict";var ppe=Ny(),mpe=ff(),il=De(),hpe=jy(),gpe=Wo(),lT=class extends hpe.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=[],mpe.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||(gpe.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(ppe.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(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=My(t,i,r);o>n&&(n=o)}return n}else if(il.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}dH.Alias=lT});var Dt=v(uT=>{"use strict";var ype=De(),_pe=jy(),bpe=Wo(),vpe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends _pe.NodeBase{constructor(e){super(ype.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:bpe.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";uT.Scalar=Ko;uT.isScalarValue=vpe});var yf=v(pH=>{"use strict";var Spe=gf(),ha=De(),fH=Dt(),wpe="tag:yaml.org,2002:";function xpe(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 $pe(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 Spe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=wpe+e.slice(2));let l=xpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new fH.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 fH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}pH.createNode=$pe});var Ly=v(Fy=>{"use strict";var kpe=yf(),Oi=De(),Epe=jy();function dT(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 kpe.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 mH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,fT=class extends Epe.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(mH(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,dT(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,dT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=fT;Fy.collectionFromPath=dT;Fy.isEmptyPath=mH});var _f=v(zy=>{"use strict";var Ape=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function pT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tpe=(t,e,r)=>t.endsWith(` +`)?pT(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===` -`)r===pT&&(h=dH(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+pT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=pT;zy.lineComment=Tpe;zy.stringifyComment=Ape});var gH=v(bf=>{"use strict";var Ope="flow",mT="block",Uy="quoted";function Rpe(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===mT&&(h=hH(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===mT&&(h=hH(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{"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=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=gH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function Ipe(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 vf(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(` +${l}${_}${r}${p}`}function Ppe(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?` +`)?ol(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 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,Hy(e,!1))}function Cpe(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):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return vf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return hT(s.value,e);case Xn.Scalar.PLAIN:return Ppe(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}yH.stringifyString=Cpe});var wf=v(yT=>{"use strict";var Dpe=Ny(),Yo=De(),Npe=_f(),jpe=Sf();function Mpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Npe.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 Fpe(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 Lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Dpe.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 zpe(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=Fpe(e.doc.schema.tags,o));let s=Lpe(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)?jpe.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}yT.createStringifyContext=Mpe;yT.stringify=zpe});var SH=v(vH=>{"use strict";var go=De(),_H=Dt(),bH=wf(),xf=_f();function Upe({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===_H.Scalar.BLOCK_FOLDED||t.type===_H.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=bH.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+=xf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=xf.lineComment(g,r.indent,l(f))),g=`? ${g} +${a}:`):(g=`${g}:`,f&&(g+=xf.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=bH.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===` +${xf.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 wH=Ge("process");function qpe(t,...e){t==="debug"&&console.log(...e)}function Hpe(t,e){(t==="debug"||t==="warn")&&(typeof wH.emitWarning=="function"?wH.emitWarning(e):console.warn(e))}_T.debug=qpe;_T.warn=Hpe});var Ky=v(Wy=>{"use strict";var Vy=De(),xH=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 xH.Scalar(Symbol(Gy)),{addToJSMap:$H}),stringify:()=>Gy},Bpe=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===xH.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function $H(t,e,r){let n=kH(t,r);if(Vy.isSeq(n))for(let i of n.items)vT(t,e,i);else if(Array.isArray(n))for(let i of n)vT(t,e,i);else vT(t,e,n)}function vT(t,e,r){let n=kH(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 kH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=$H;Wy.isMergeKey=Bpe;Wy.merge=Zy});var wT=v(TH=>{"use strict";var Gpe=bT(),EH=Ky(),Zpe=wf(),AH=De(),ST=Wo();function Vpe(t,e,{key:r,value:n}){if(AH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(EH.isMergeKey(t,r))EH.addMergeToJSMap(t,e,n);else{let i=ST.toJS(r,"",t);if(e instanceof Map)e.set(i,ST.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Wpe(r,i,t),s=ST.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 Wpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(AH.isNode(t)&&r?.doc){let n=Zpe.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)+'..."'),Gpe.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)}TH.addPairToJSMap=Vpe});var Xo=v(xT=>{"use strict";var OH=yf(),Kpe=SH(),Jpe=wT(),Jy=De();function Ype(t,e,r){let n=OH.createNode(t,void 0,r),i=OH.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 Jpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Kpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};xT.Pair=Yy;xT.createPair=Ype});var $T=v(IH=>{"use strict";var ga=De(),RH=wf(),Xy=_f();function Xpe(t,e,r){return(e.inFlow??t.flow?eme:Qpe)(t,e,r)}function Qpe({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 eme({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())}}IH.stringifyCollection=Xpe});var es=v(ET=>{"use strict";var tme=$T(),rme=wT(),nme=Ly(),Qo=De(),e_=Xo(),ime=Dt();function $f(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 kT=class extends nme.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=$f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&ime.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=$f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=$f(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!$f(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)rme.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})),tme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};ET.YAMLMap=kT;ET.findPair=$f});var sl=v(CH=>{"use strict";var ome=De(),PH=es(),sme={collection:"map",default:!0,nodeClass:PH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ome.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>PH.YAMLMap.from(t,e,r)};CH.map=sme});var ts=v(DH=>{"use strict";var ame=yf(),cme=$T(),lme=Ly(),r_=De(),ume=Dt(),dme=Wo(),AT=class extends lme.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}DH.YAMLSeq=AT});var al=v(jH=>{"use strict";var fme=De(),NH=ts(),pme={collection:"seq",default:!0,nodeClass:NH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return fme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>NH.YAMLSeq.from(t,e,r)};jH.seq=pme});var kf=v(MH=>{"use strict";var mme=Sf(),hme={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),mme.stringifyString(t,e,r,n)}};MH.string=hme});var n_=v(zH=>{"use strict";var FH=Dt(),LH={identify:t=>t==null,createNode:()=>new FH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new FH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&LH.test.test(t)?t:e.options.nullStr};zH.nullTag=LH});var TT=v(qH=>{"use strict";var gme=Dt(),UH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new gme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&UH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};qH.boolTag=UH});var cl=v(HH=>{"use strict";function yme({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}HH.stringifyNumber=yme});var RT=v(i_=>{"use strict";var _me=Dt(),OT=cl(),bme={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:OT.stringifyNumber},vme={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():OT.stringifyNumber(t)}},Sme={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 _me.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:OT.stringifyNumber};i_.float=Sme;i_.floatExp=vme;i_.floatNaN=bme});var PT=v(s_=>{"use strict";var BH=cl(),o_=t=>typeof t=="bigint"||Number.isInteger(t),IT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function GH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):BH.stringifyNumber(t)}var wme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>IT(t,2,8,r),stringify:t=>GH(t,8,"0o")},xme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>IT(t,0,10,r),stringify:BH.stringifyNumber},$me={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)=>IT(t,2,16,r),stringify:t=>GH(t,16,"0x")};s_.int=xme;s_.intHex=$me;s_.intOct=wme});var VH=v(ZH=>{"use strict";var kme=sl(),Eme=n_(),Ame=al(),Tme=kf(),Ome=TT(),CT=RT(),DT=PT(),Rme=[kme.map,Ame.seq,Tme.string,Eme.nullTag,Ome.boolTag,DT.intOct,DT.int,DT.intHex,CT.floatNaN,CT.floatExp,CT.float];ZH.schema=Rme});var JH=v(KH=>{"use strict";var Ime=Dt(),Pme=sl(),Cme=al();function WH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Dme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new Ime.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:WH,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})=>WH(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_}],Nme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},jme=[Pme.map,Cme.seq].concat(Dme,Nme);KH.schema=jme});var jT=v(YH=>{"use strict";var Ef=Ge("buffer"),NT=Dt(),Mme=Sf(),Fme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ef.Buffer=="function")return Ef.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(),MT=Xo(),Lme=Dt(),zme=ts();function XH(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 MT.Pair(new Lme.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 MT.Pair(n)}}else e("Expected a sequence for this tag");return t}function QH(t,e,r){let{replacer:n}=r,i=new zme.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(MT.createPair(a,c,r))}return i}var Ume={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:XH,createNode:QH};l_.createPairs=QH;l_.pairs=Ume;l_.resolvePairs=XH});var zT=v(LT=>{"use strict";var e6=De(),FT=Wo(),Af=es(),qme=ts(),t6=u_(),ya=class t extends qme.YAMLSeq{constructor(){super(),this.add=Af.YAMLMap.prototype.add.bind(this),this.delete=Af.YAMLMap.prototype.delete.bind(this),this.get=Af.YAMLMap.prototype.get.bind(this),this.has=Af.YAMLMap.prototype.has.bind(this),this.set=Af.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(e6.isPair(i)?(o=FT.toJS(i.key,"",r),s=FT.toJS(i.value,o,r)):o=FT.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=t6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var Hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=t6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)e6.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)};LT.YAMLOMap=ya;LT.omap=Hme});var s6=v(UT=>{"use strict";var r6=Dt();function n6({value:t,source:e},r){return e&&(t?i6:o6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var i6={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 r6.Scalar(!0),stringify:n6},o6={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 r6.Scalar(!1),stringify:n6};UT.falseTag=o6;UT.trueTag=i6});var a6=v(d_=>{"use strict";var Bme=Dt(),qT=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:qT.stringifyNumber},Zme={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():qT.stringifyNumber(t)}},Vme={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 Bme.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:qT.stringifyNumber};d_.float=Vme;d_.floatExp=Zme;d_.floatNaN=Gme});var l6=v(Of=>{"use strict";var c6=cl(),Tf=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 HT(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return c6.stringifyNumber(t)}var Wme={identify:Tf,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=>HT(t,2,"0b")},Kme={identify:Tf,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=>HT(t,8,"0")},Jme={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:c6.stringifyNumber},Yme={identify:Tf,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=>HT(t,16,"0x")};Of.int=Jme;Of.intBin=Wme;Of.intHex=Yme;Of.intOct=Kme});var GT=v(BT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var Xme={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(h_.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}};BT.YAMLSet=_a;BT.set=Xme});var VT=v(g_=>{"use strict";var Qme=cl();function ZT(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 u6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Qme.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 ehe={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})=>ZT(t,r),stringify:u6},the={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=>ZT(t,!1),stringify:u6},d6={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(d6.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=ZT(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=the;g_.intTime=ehe;g_.timestamp=d6});var m6=v(p6=>{"use strict";var rhe=sl(),nhe=n_(),ihe=al(),ohe=kf(),she=jT(),f6=s6(),WT=a6(),y_=l6(),ahe=Ky(),che=zT(),lhe=u_(),uhe=GT(),KT=VT(),dhe=[rhe.map,ihe.seq,ohe.string,nhe.nullTag,f6.trueTag,f6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,WT.floatNaN,WT.floatExp,WT.float,she.binary,ahe.merge,che.omap,lhe.pairs,uhe.set,KT.intTime,KT.floatTime,KT.timestamp];p6.schema=dhe});var $6=v(XT=>{"use strict";var _6=sl(),fhe=n_(),b6=al(),phe=kf(),mhe=TT(),JT=RT(),YT=PT(),hhe=VH(),ghe=JH(),v6=jT(),Rf=Ky(),S6=zT(),w6=u_(),h6=m6(),x6=GT(),__=VT(),g6=new Map([["core",hhe.schema],["failsafe",[_6.map,b6.seq,phe.string]],["json",ghe.schema],["yaml11",h6.schema],["yaml-1.1",h6.schema]]),y6={binary:v6.binary,bool:mhe.boolTag,float:JT.float,floatExp:JT.floatExp,floatNaN:JT.floatNaN,floatTime:__.floatTime,int:YT.int,intHex:YT.intHex,intOct:YT.intOct,intTime:__.intTime,map:_6.map,merge:Rf.merge,null:fhe.nullTag,omap:S6.omap,pairs:w6.pairs,seq:b6.seq,set:x6.set,timestamp:__.timestamp},yhe={"tag:yaml.org,2002:binary":v6.binary,"tag:yaml.org,2002:merge":Rf.merge,"tag:yaml.org,2002:omap":S6.omap,"tag:yaml.org,2002:pairs":w6.pairs,"tag:yaml.org,2002:set":x6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function _he(t,e,r){let n=g6.get(e);if(n&&!t)return r&&!n.includes(Rf.merge)?n.concat(Rf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(g6.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(Rf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?y6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(y6).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},[])}XT.coreKnownTags=yhe;XT.getTags=_he});var tO=v(k6=>{"use strict";var QT=De(),bhe=sl(),vhe=al(),She=kf(),b_=$6(),whe=(t,e)=>t.keye.key?1:0,eO=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,QT.MAP,{value:bhe.map}),Object.defineProperty(this,QT.SCALAR,{value:She.string}),Object.defineProperty(this,QT.SEQ,{value:vhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?whe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};k6.Schema=eO});var A6=v(E6=>{"use strict";var xhe=De(),rO=wf(),If=_f();function $he(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=rO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(If.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(xhe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(If.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=rO.stringify(t.contents,i,()=>a=null,c);a&&(l+=If.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(rO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +`)?(r.push("..."),r.push(If.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(If.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 +`}E6.stringifyDocument=$he});var Pf=v(T6=>{"use strict";var khe=gf(),ll=Ly(),Rn=De(),Ehe=Xo(),Ahe=Wo(),The=tO(),Ohe=A6(),nO=Ny(),Rhe=aT(),Ihe=yf(),iO=sT(),oO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 iO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.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=nO.anchorNames(this);e.anchor=!r||n.has(r)?nO.findNewAnchor(r||"a",n):r}return new khe.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}=nO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Ihe.createNode(e,u,m);return a&&Rn.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 Ehe.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 Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ll.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ll.isEmptyPath(e)?this.contents!==void 0:Rn.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 iO.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 iO.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 The.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=Ahe.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"?Rhe.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 Ohe.stringifyDocument(this,e)}};function ul(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=oO});var Nf=v(Df=>{"use strict";var Cf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},sO=class extends Cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},aO=class extends Cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Phe=(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+=` -`+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;g0){let g=Zhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}U6.resolveFlowCollection=Khe});var B6=v(H6=>{"use strict";var Jhe=De(),Yhe=Dt(),Xhe=es(),Qhe=ts(),ege=N6(),tge=M6(),rge=q6();function fO(t,e,r,n,i,o){let s=r.type==="block-map"?ege.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?tge.resolveBlockSeq(t,e,r,n,o):rge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function nge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),fO(t,e,r,i,s)}let l=fO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Jhe.isNode(u)?u:new Yhe.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}H6.composeCollection=nge});var mO=v(G6=>{"use strict";var pO=Dt();function ige(t,e,r){let n=e.offset,i=oge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?pO.Scalar.BLOCK_FOLDED:pO.Scalar.BLOCK_LITERAL,s=e.source?sge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};Df.YAMLError=Cf;Df.YAMLParseError=sO;Df.YAMLWarning=aO;Df.prettifyError=Phe});var jf=v(O6=>{"use strict";function Che(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}}O6.resolveProps=Che});var v_=v(R6=>{"use strict";function cO(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(cO(e.key)||cO(e.value))return!0}return!1;default:return!0}}R6.containsNewline=cO});var lO=v(I6=>{"use strict";var Dhe=v_();function Nhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Dhe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}I6.flowIndentCheck=Nhe});var uO=v(C6=>{"use strict";var P6=De();function jhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||P6.isScalar(o)&&P6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}C6.mapIncludes=jhe});var L6=v(F6=>{"use strict";var D6=Xo(),Mhe=es(),N6=jf(),Fhe=v_(),j6=lO(),Lhe=uO(),M6="All mapping items must start at the same column";function zhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Mhe.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=N6.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",M6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Fhe.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",M6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&j6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Lhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=N6.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 Uhe=ts(),qhe=jf(),Hhe=lO();function Bhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Uhe.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=qhe.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&&Hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}z6.resolveBlockSeq=Bhe});var dl=v(q6=>{"use strict";function Ghe(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}}q6.resolveEnd=Ghe});var Z6=v(G6=>{"use strict";var Zhe=De(),Vhe=Xo(),H6=es(),Whe=ts(),Khe=dl(),B6=jf(),Jhe=v_(),Yhe=uO(),dO="Block collections are not allowed within flow collections",fO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Xhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?H6.YAMLMap:Whe.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=Khe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}G6.resolveFlowCollection=Xhe});var W6=v(V6=>{"use strict";var Qhe=De(),ege=Dt(),tge=es(),rge=ts(),nge=L6(),ige=U6(),oge=Z6();function pO(t,e,r,n,i,o){let s=r.type==="block-map"?nge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?ige.resolveBlockSeq(t,e,r,n,o):oge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function sge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),pO(t,e,r,i,s)}let l=pO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Qhe.isNode(u)?u:new ege.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}V6.composeCollection=sge});var hO=v(K6=>{"use strict";var mO=Dt();function age(t,e,r){let n=e.offset,i=cge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?mO.Scalar.BLOCK_FOLDED:mO.Scalar.BLOCK_LITERAL,s=e.source?lge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,87 +112,87 @@ ${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 gO=Dt(),uge=dl();function dge(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=gO.Scalar.PLAIN,c=fge(o,l);break;case"single-quoted-scalar":a=gO.Scalar.QUOTE_SINGLE,c=pge(o,l);break;case"double-quoted-scalar":a=gO.Scalar.QUOTE_DOUBLE,c=mge(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=uge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function fge(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}`),J6(t)}function pge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),J6(t.slice(1,-1)).replace(/''/g,"'")}function J6(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function fge(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function hge(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var pge={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function mge(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}V6.resolveFlowScalar=cge});var J6=v(K6=>{"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 ba=De(),X6=Dt(),_ge=hO(),bge=yO();function vge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?_ge.resolveBlockScalar(t,e,n):bge.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=Sge(t.schema,i,c,r,n):e.type==="scalar"?l=wge(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 X6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new X6.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 Sge(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 wge({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}Q6.composeScalar=vge});var rB=v(tB=>{"use strict";function xge(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}tB.emptyScalarPosition=xge});var oB=v(bO=>{"use strict";var $ge=gf(),kge=De(),Ege=W6(),nB=eB(),Age=dl(),Tge=rB(),Oge={composeNode:iB,composeEmptyNode:_O};function iB(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=Rge(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=nB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ege.composeCollection(Oge,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=_O(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&&(!kge.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 _O(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Tge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=nB.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 Rge({options:t},{offset:e,source:r,end:n},i){let o=new $ge.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=Age.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}bO.composeEmptyNode=_O;bO.composeNode=iB});var cB=v(aB=>{"use strict";var Ige=Pf(),sB=oB(),Pge=dl(),Cge=jf();function Dge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Ige.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Cge.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?sB.composeNode(l,i,u,s):sB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Pge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}aB.composeDoc=Dge});var SO=v(dB=>{"use strict";var Nge=Ge("process"),jge=sT(),Mge=Pf(),Mf=Nf(),lB=De(),Fge=cB(),Lge=dl();function Ff(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 uB(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} -${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} +`)+(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 vO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Ff(r);o?this.warnings.push(new Mf.YAMLWarning(s,n,i)):this.errors.push(new Mf.YAMLParseError(s,n,i))},this.directives=new jge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=uB(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(lB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];lB.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=Ff(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Fge.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 Mf.YAMLParseError(Ff(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 Mf.YAMLParseError(Ff(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Lge.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 Mf.YAMLParseError(Ff(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 Mge.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}}};dB.Composer=vO});var mB=v(S_=>{"use strict";var zge=hO(),Uge=yO(),qge=Nf(),fB=Sf();function Hge(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 qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Uge.resolveFlowScalar(t,e,n);case"block-scalar":return zge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Bge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=fB.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:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function qge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=cB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Hge(t,c);break;case'"':SO(t,c,"double-quoted-scalar");break;case"'":SO(t,c,"single-quoted-scalar");break;default:SO(t,c,"scalar")}}function Hge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return pB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Gge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=fB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Zge(t,c);break;case'"':wO(t,c,"double-quoted-scalar");break;case"'":wO(t,c,"single-quoted-scalar");break;default:wO(t,c,"scalar")}}function Zge(t,e){let r=e.indexOf(` `),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` +`;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}];pB(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 pB(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 wO(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})}}}S_.createScalarToken=Bge;S_.resolveAsScalar=Hge;S_.setScalarValue=Gge});var gB=v(hB=>{"use strict";var Vge=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}hB.stringify=Vge});var vB=v(bB=>{"use strict";var xO=Symbol("break visit"),Wge=Symbol("skip children"),yB=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),_B(Object.freeze([]),t,e)}va.BREAK=xO;va.SKIP=Wge;va.REMOVE=yB;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 _B(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 $O=mB(),Kge=gB(),Jge=vB(),kO="\uFEFF",EO="",AO="",TO="",Yge=t=>!!t&&"items"in t,Xge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Qge(t){switch(t){case kO:return"";case EO:return"";case AO:return"";case TO:return"";default:return JSON.stringify(t)}}function eye(t){switch(t){case kO:return"byte-order-mark";case EO:return"doc-mode";case AO:return"flow-error-end";case TO: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(` ,[]{} -\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===` +`: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=$O.createScalarToken;Mr.resolveAsScalar=$O.resolveAsScalar;Mr.setScalarValue=$O.setScalarValue;Mr.stringify=Kge.stringify;Mr.visit=Jge.visit;Mr.BOM=kO;Mr.DOCUMENT=EO;Mr.FLOW_END=AO;Mr.SCALAR=TO;Mr.isCollection=Yge;Mr.isScalar=Xge;Mr.prettyToken=Qge;Mr.tokenType=eye});var IO=v(wB=>{"use strict";var Lf=$_();function Qn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var SB=new Set("0123456789ABCDEFabcdef"),tye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),rye=new Set(` ,[]{} +\r `),OO=t=>!t||rye.has(t),RO=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(OO),"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 Lf.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 Lf.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(OO),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(tye.has(r))r=this.buffer[++e];else if(r==="%"&&SB.has(this.buffer[e+1])&&SB.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)}};wB.Lexer=RO});var CO=v(xB=>{"use strict";var PO=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 nye=Ge("process"),$B=$_(),iye=IO();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"&&EB(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&&kB(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(AB(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)){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=fl(i);EB(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)} -`,"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=` +`,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=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=E_(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())}}};TB.Parser=DO});var CB=v(Uf=>{"use strict";var OB=SO(),oye=Pf(),zf=Nf(),sye=bT(),aye=De(),cye=CO(),RB=NO();function IB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new cye.LineCounter||null,prettyErrors:e}}function lye(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(zf.prettifyError(t,r)),a.warnings.forEach(zf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function PB(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.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 zf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(zf.prettifyError(t,r)),s.warnings.forEach(zf.prettifyError(t,r))),s}function uye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=PB(t,r);if(!i)return null;if(i.warnings.forEach(o=>sye.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 dye(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 aye.isDocument(t)&&!n?t.toString(r):new oye.Document(t,n,r).toString(r)}Uf.parse=uye;Uf.parseAllDocuments=lye;Uf.parseDocument=PB;Uf.stringify=dye});var tr=v(Ze=>{"use strict";var fye=SO(),pye=Pf(),mye=tO(),jO=Nf(),hye=gf(),ns=De(),gye=Xo(),yye=Dt(),_ye=es(),bye=ts(),vye=$_(),Sye=IO(),wye=CO(),xye=NO(),T_=CB(),DB=ff();Ze.Composer=fye.Composer;Ze.Document=pye.Document;Ze.Schema=mye.Schema;Ze.YAMLError=jO.YAMLError;Ze.YAMLParseError=jO.YAMLParseError;Ze.YAMLWarning=jO.YAMLWarning;Ze.Alias=hye.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=gye.Pair;Ze.Scalar=yye.Scalar;Ze.YAMLMap=_ye.YAMLMap;Ze.YAMLSeq=bye.YAMLSeq;Ze.CST=vye;Ze.Lexer=Sye.Lexer;Ze.LineCounter=wye.LineCounter;Ze.Parser=xye.Parser;Ze.parse=T_.parse;Ze.parseAllDocuments=T_.parseAllDocuments;Ze.parseDocument=T_.parseDocument;Ze.stringify=T_.stringify;Ze.visit=DB.visit;Ze.visitAsync=DB.visitAsync});import{execFileSync as MO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as $ye}from"node:path";function kye(t){try{let e=MO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?$ye(t,e):null}catch{return null}}function FO(t){let e=kye(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 Sa(t){return FO(t)!==null}function qf(t,e){try{let r=MO("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 qf(t,e)!==null}function NB(t,e){try{let r=MO("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 Eye}from"node:child_process";import{existsSync as Aye,readFileSync as Tye}from"node:fs";import{join as MB}from"node:path";function hl(t,e){return Eye("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){FB(t,e);let r=hl(t,["rev-parse","HEAD"]).trim(),n=Oye(t,e);return{groups:Rye(t,n),head:r,inventory:{after:jB(C_(t,"spec.yaml")),before:jB(Hf(t,e,"spec.yaml"))},since:e,unsharded_commits:Dye(t,e)}}function LO(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 FB(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 Oye(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(!(!P_(c)&&!P_(a)))if(s.startsWith("A")){let l=ml(C_(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(Hf(t,e,a));l&&n.push(pl(l,"archived"))}else{let l=ml(C_(t,c));if(!l)continue;let d=ml(Hf(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 P_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function LB(t,e){FB(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(!P_(c)&&!P_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?ml(Hf(t,"HEAD",c)):null,f=l?null:ml(Hf(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=>LO(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,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=MB(t,e);if(!Aye(r))return null;try{return Tye(r,"utf8")}catch{return null}}function Hf(t,e,r){try{return hl(t,["show",`${e}:${r}`])}catch{return null}}function Rye(t,e){let r=Iye(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 Iye(t){let e=C_(t,MB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function jB(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 Dye(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);Pye.test(a)&&(Cye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Pye,Cye,gl=y(()=>{"use strict";D_=wt(tr(),1);wa();Pye=/^(feat|fix)(\([^)]*\))?!?:/,Cye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as zB}from"node:child_process";import{appendFileSync as Nye,existsSync as zO,mkdirSync as jye,readFileSync as Mye,renameSync as Fye,statSync as Lye}from"node:fs";import{userInfo as zye}from"node:os";import{dirname as Uye,join as qO}from"node:path";function HO(t){return qO(t,UB,qye)}function rn(t,e){let r=HO(t),n=Uye(r);zO(n)||jye(n,{recursive:!0});try{zO(r)&&Lye(r).size>Hye&&Fye(r,qO(n,qB))}catch{}Nye(r,`${JSON.stringify(e)} +`,"utf8")}function UO(t){if(!zO(t))return[];let e=Mye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return UO(HO(t))}function N_(t){return[...UO(qO(t,UB,qB)),...UO(HO(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 Bye(t){let e;try{e=zB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=zye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Gye(t){try{return zB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Bf(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=Gye(t),i=Bye(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 UB,qye,qB,Hye,Fr=y(()=>{"use strict";UB=".cladding",qye="events.log.jsonl",qB="events.log.1.jsonl",Hye=5*1024*1024});import{execFileSync as Zye}from"node:child_process";import{existsSync as HB,readdirSync as Vye,readFileSync as Wye,statSync as BB}from"node:fs";import{createHash as Kye}from"node:crypto";import{join as BO}from"node:path";function xa(t){try{return Zye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function GO(t){let e=[],r=BO(t,"spec.yaml");HB(r)&&BB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=BO(t,"spec",i);if(!(!HB(o)||!BB(o).isDirectory()))for(let s of Vye(o))s.endsWith(".yaml")&&e.push(BO(o,s))}e.sort();let n=Kye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Wye(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:GO(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 Gf=y(()=>{"use strict";Fr()});import{readFileSync as Jye,statSync as Yye}from"node:fs";import{extname as Xye,resolve as ZO,sep as Qye}from"node:path";function on(t){return Math.ceil(t.length/4)}function r_e(t,e){let r=ZO(e),n=ZO(r,t);return n===r||n.startsWith(r+Qye)}function ZB(t,e,r,n){if(!r_e(t,e))return{path:t,omitted:"unsafe-path"};if(!e_e.has(Xye(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>GB)return{path:t,omitted:"too-large",bytes:o}}else{let l=ZO(e,t);try{o=Yye(l).size}catch{return{path:t,omitted:"missing"}}if(o>GB)return{path:t,omitted:"too-large",bytes:o};try{i=Jye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(t_e))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)} -`,"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(` -`)}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: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var e_e,GB,t_e,L_=y(()=>{"use strict";e_e=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"]),GB=2e6,t_e="\0"});function Zf(t){for(let i of n_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 VO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function i_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??[])VO(e,s,o);for(let s of i.modules??[])VO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Zf(a);c&&VO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=VB.get(t);return e||(e=i_e(t),VB.set(t,e)),e}var n_e,VB,as=y(()=>{"use strict";n_e=["derived:","fixture:","script:","self-dogfood:"];VB=new WeakMap});function WO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=o_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=WO(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:KO(i)}}var $a=y(()=>{"use strict";as()});function WB(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=In(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=WO(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=WB(_),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_,JO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function s_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 KB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=s_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 JB=y(()=>{"use strict"});function a_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=a_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=KB(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";JB()});import{existsSync as XB,readdirSync as c_e,readFileSync as l_e}from"node:fs";import{join as XO}from"node:path";function QO(t,e=d_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function f_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:QO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:QO(`done reverted \u2014 pre-push strict gate red${r}`)}}function YB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function p_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 QO(n)}function m_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)=>YB(m)-YB(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(-u_e).map(f_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?p_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 YO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function h_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 g_e(t,e,r){let n=YO(t,/_Rolled back at_\s*`([^`]+)`/),i=YO(t,/Last failed gate:\s*`([^`]+)`/),o=YO(t,/Retry attempts:\s*(\d+)/),s=h_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function y_e(t,e){let r=XO(t,".cladding","post-mortems");if(!XB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of c_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(g_e(l_e(XO(r,o),"utf8"),e,o))}catch{}return i}function QB(t,e){try{let r=N_(t),n=y_e(t,e),i=XB(XO(t,".cladding","events.log.1.jsonl"));return m_e(r,n,e,{truncated:i})}catch{return}}var u_e,d_e,eG=y(()=>{"use strict";Fr();u_e=5,d_e=120});function H_(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:__e,o=e,s,a=In(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=QB(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>b_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 __e,b_e,B_=y(()=>{"use strict";L_();q_();JO();eG();$a();as();__e=3e3,b_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 v_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 tG(t,e,r="."){let n=In(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=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:v_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,G_=y(()=>{"use strict";L_();JO();B_();as();_l="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as S_e,existsSync as eR,mkdirSync as w_e,readFileSync as rG}from"node:fs";import{dirname as x_e,join as $_e}from"node:path";function tR(t){return $_e(t,k_e,E_e)}function A_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:GO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function nG(t,e){try{let r=A_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=rR(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=tR(t),s=x_e(o);return eR(s)||w_e(s,{recursive:!0}),S_e(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function iG(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 rR(t,e){let r=tR(t);if(!eR(r))return[];let n;try{n=rG(r,"utf8")}catch{return[]}let i=iG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function oG(t){let e=tR(t);if(!eR(e))return{snapshots:[],unreadable:!1};let r;try{r=rG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=iG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Vf(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 sG(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?` (${Vf(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 k_e,E_e,Wf=y(()=>{"use strict";Gf();G_();k_e=".cladding",E_e="measure.jsonl"});import{existsSync as T_e}from"node:fs";import{join as O_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}** (${R_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 cG(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 ${Vf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Vf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Vf(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"} | ${P_e(l,r)} |`)}return n.join(` +`)}function P_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 I_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${T_e(O_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),aG(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)aG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function aG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=LO(r);n&&t.push(`- ${n}`)}t.push("")}var R_e,I_e,Z_=y(()=>{"use strict";Wf();G_();gl();R_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};I_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 C_e}from"node:fs";function Ri(t="./spec.yaml"){let e=C_e(t,"utf8");return(0,lG.parse)(e)}var lG,V_=y(()=>{"use strict";lG=wt(tr(),1)});var cs=v((Lr,sR)=>{"use strict";var nR=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+dG(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()};nR.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 nR(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 nR(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};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 D_e(t,e){return e+": "+t.toString()+` +`}W_.prototype.toString=function(e){return this.errors.map(D_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});sR.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 uG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};uG.prototype=Object.create(Error.prototype,{constructor:{value:uG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var iR=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+dG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};iR.prototype.resolve=function(e){return fG(this.base,e)};iR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=fG(this.base,i||"");var s=new iR(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 dG=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 N_e(t,e,r,n){typeof r=="object"?e[n]=oR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function j_e(t,e,r){e[r]=t[r]}function M_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=oR(t[n],e[n]):r[n]=e[n]}function oR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(N_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(j_e.bind(null,t,n)),Object.keys(e).forEach(M_e.bind(null,t,e,n))),n}sR.exports.deepMerge=oR;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 F_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(F_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 fG=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 gG=v((QQe,hG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,aR={};aR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=aR.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 cR(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(cR.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(cR.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=cR.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 lR(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(lR(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=lR(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 pG(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&&pG.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)pG.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 L_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var uR=cs();dR.exports.SchemaScanResult=yG;function yG(t,e){this.id=t,this.ref=e}dR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=uR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=uR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!uR.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 _G=gG(),us=cs(),bG=K_().scan,vG=us.ValidatorResult,z_e=us.ValidatorResultError,Kf=us.SchemaError,SG=us.SchemaContext,U_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(_G.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=bG(r||U_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 Kf("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 Kf('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)};xG.exports=Yt});var kG=v((ret,yo)=>{"use strict";var q_e=yo.exports.Validator=$G();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 q_e;return n.validate(t,e,r)}});import{readFileSync as H_e}from"node:fs";import{dirname as B_e,join as G_e}from"node:path";import{fileURLToPath as Z_e}from"node:url";function Y_e(t){let e=J_e.validate(t,K_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function AG(t){let e=Y_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} + `)}`)}var EG,V_e,W_e,K_e,J_e,TG=y(()=>{"use strict";EG=wt(kG(),1),V_e=B_e(Z_e(import.meta.url)),W_e=G_e(V_e,"schema.json"),K_e=JSON.parse(H_e(W_e,"utf8")),J_e=new EG.Validator});import{existsSync as fR,readdirSync as X_e}from"node:fs";import{dirname as Q_e,join as Aa,resolve as RG}from"node:path";function OG(t){return fR(t)?X_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:RG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&RG(t)===J_.cwd?J_.spec:ebe(t,e)}function ebe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,Q_e(e),"spec");if(!n.features||n.features.length===0){let o=OG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=OG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");fR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(fR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return AG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import wl from"node:process";function hR(){return!!wl.stdout.isTTY}function L(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";hR()?wl.stdout.write(`${pR[t]}${n}${mR} ${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} +`)}function Jf(t,e,r=""){if(!hR())return;let n=r?` ${r}`:"";wl.stdout.write(`${PG}${pR.start}\xB7${mR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";hR()?wl.stdout.write(`${PG}${pR[t]}${n}${mR} ${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 IG,pR,mR,PG,Pi=y(()=>{"use strict";IG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},pR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},mR="\x1B[0m",PG="\r\x1B[K"});import{createHash as _R}from"node:crypto";import{existsSync as Fbe,readFileSync as bR,writeFileSync as Lbe}from"node:fs";import{join as Y_}from"node:path";function iZ(t){let e=_R("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function zbe(t,e){let r=_R("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(bR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oZ(t,e){let r=_R("sha256");try{r.update(bR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...nZ);if(!Fbe(e))return null;let r;try{r=bR(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)!==oZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===zbe(e,n)?{state:"fresh"}:{state:"stale"}}function sZ(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}: ${oZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Ube+(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 Lbe(Y_(t,...nZ),a,"utf8"),!0}var nZ,Ube,$l=y(()=>{"use strict";nZ=["spec","attestation.yaml"];Ube=`# 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;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. +`});import{resolve as vR}from"node:path";function eb(t){fs={cwd:vR(t),results:new Map}}function aZ(t,e,r){!fs||fs.cwd!==vR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==vR(e)?null:fs.results.get(t)??null}function rb(){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 qbe}from"node:url";var El,Hbe,SR,wR,Al=y(()=>{El=(t,e)=>{let r=wR(Hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Hbe=t=>SR(t)?t.toString():t,SR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,wR=t=>t instanceof URL?qbe(t):t});var nb,xR=y(()=>{bo();Al();nb=(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 Bbe}from"node:string_decoder";var cZ,lZ,qt,vo,Gbe,uZ,Zbe,ib,dZ,Vbe,Xf,Wbe,$R,Kbe,an=y(()=>{({toString:cZ}=Object.prototype),lZ=t=>cZ.call(t)==="[object ArrayBuffer]",qt=t=>cZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gbe=new TextEncoder,uZ=t=>Gbe.encode(t),Zbe=new TextDecoder,ib=t=>Zbe.decode(t),dZ=(t,e)=>Vbe(t,e).join(""),Vbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Bbe(e),n=t.map(o=>typeof o=="string"?uZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Xf=t=>t.length===1&&qt(t[0])?t[0]:$R(Wbe(t)),Wbe=t=>t.map(e=>typeof e=="string"?uZ(e):e),$R=t=>{let e=new Uint8Array(Kbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Kbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Jbe}from"node:child_process";var hZ,gZ,Ybe,Xbe,fZ,Qbe,pZ,mZ,eve,yZ=y(()=>{bo();an();hZ=t=>Array.isArray(t)&&Array.isArray(t.raw),gZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Ybe({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,{}]},Ybe=({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}=Xbe(i,t.raw[n]),c=pZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mZ(d)):[mZ(l)];return pZ(c,u,a)},Xbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fZ.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)],mZ=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 eve(t);throw t instanceof Jbe||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`)},eve=({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 kR from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[kR.stdin,kR.stdout,kR.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as tve}from"node:util";var bZ,ER,rve,nve,ive,ove,_Z,sve,AR,ave,cve,lve,uve,TR,wo,xo=y(()=>{bo();So();bZ=t=>{let e={...t};for(let r of TR)e[r]=ER(t,r);return e},ER=(t,e)=>{let r=Array.from({length:rve(t)+1}),n=nve(t[e],r,e);return cve(n,e)},rve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,nve=(t,e,r)=>Ot(t)?ive(t,e,r):e.fill(t),ive=(t,e,r)=>{for(let n of Object.keys(t).sort(ove))for(let i of sve(n,r,e))e[i]=t[n];return e},ove=(t,e)=>_Z(t)<_Z(e)?1:-1,_Z=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,sve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=AR(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(` -`).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(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},AR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=ave.exec(t);if(e!==null)return Number(e[1])},ave=/^fd(\d+)$/,cve=(t,e)=>t.map(r=>r===void 0?uve[e]:r),lve=tve("execa").enabled?"full":"none",uve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lve,stripFinalNewline:!0},TR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Tl,Ol,vZ,OR,dve,ab,cb,ps=y(()=>{xo();Tl=({verbose:t},e)=>OR(t,e)!=="none",Ol=({verbose:t},e)=>!["none","short"].includes(OR(t,e)),vZ=({verbose:t},e)=>{let r=OR(t,e);return ab(r)?r:void 0},OR=(t,e)=>e===void 0?dve(t):wo(t,e),dve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as fve}from"node:process";import{stripVTControlCharacters as pve}from"node:util";var SZ,Qf,wZ,mve,hve,gve,yve,_ve,bve,vve,lb=y(()=>{SZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bve(wZ(o))).join(" ");return{command:n,escapedCommand:i}},Qf=t=>pve(t).split(` +`).map(e=>wZ(e)).join(` +`),wZ=t=>t.replaceAll(gve,e=>mve(e)),mve=t=>{let e=yve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_ve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gve=hve(),yve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_ve=65535,bve=t=>vve.test(t)?t:fve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vve=/^[\w./-]+$/});import xZ from"node:process";function RR(){let{env:t}=xZ,{TERM:e,TERM_PROGRAM:r}=t;return xZ.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 $Z=y(()=>{});var kZ,EZ,Sve,wve,xve,$ve,kve,ub,dtt,AZ=y(()=>{$Z();kZ={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"},EZ={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"},Sve={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"},wve={...kZ,...EZ},xve={...kZ,...Sve},$ve=RR(),kve=$ve?wve:xve,ub=kve,dtt=Object.entries(EZ)});import Eve from"node:tty";var Ave,ve,mtt,TZ,htt,gtt,ytt,_tt,btt,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,Ttt,Ott,db,Rtt,Itt,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,OZ,Ltt,RZ,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,IR=y(()=>{Ave=Eve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Ave)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}},mtt=ve(0,0),TZ=ve(1,22),htt=ve(2,22),gtt=ve(3,23),ytt=ve(4,24),_tt=ve(53,55),btt=ve(7,27),vtt=ve(8,28),Stt=ve(9,29),wtt=ve(30,39),xtt=ve(31,39),$tt=ve(32,39),ktt=ve(33,39),Ett=ve(34,39),Att=ve(35,39),Ttt=ve(36,39),Ott=ve(37,39),db=ve(90,39),Rtt=ve(40,49),Itt=ve(41,49),Ptt=ve(42,49),Ctt=ve(43,49),Dtt=ve(44,49),Ntt=ve(45,49),jtt=ve(46,49),Mtt=ve(47,49),Ftt=ve(100,49),OZ=ve(91,39),Ltt=ve(92,39),RZ=ve(93,39),ztt=ve(94,39),Utt=ve(95,39),qtt=ve(96,39),Htt=ve(97,39),Btt=ve(101,49),Gtt=ve(102,49),Ztt=ve(103,49),Vtt=ve(104,49),Wtt=ve(105,49),Ktt=ve(106,49),Jtt=ve(107,49)});var IZ=y(()=>{IR();IR()});var DZ,Ove,fb,PZ,Rve,CZ,Ive,NZ=y(()=>{AZ();IZ();DZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ove(r),c=Rve[t]({failed:o,reject:s,piped:n}),l=Ive[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},Ove=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"),PZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PZ,duration:PZ},CZ=t=>t,Ive={command:()=>TZ,output:()=>CZ,ipc:()=>CZ,error:({reject:t})=>t?OZ:RZ,duration:()=>db}});var jZ,Pve,Cve,MZ=y(()=>{ps();jZ=(t,e,r)=>{let n=vZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pve(i,o,n)).filter(i=>i!==void 0).map(i=>Cve(i)).join("")},Pve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cve=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. -${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()}`)},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. +`});import{inspect as Dve}from"node:util";var Ci,Nve,jve,Mve,pb,Fve,Rl=y(()=>{lb();NZ();MZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Nve({type:t,result:i,verboseInfo:n}),s=jve(e,o),a=jZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Nve=({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}),jve=(t,e)=>t.split(` +`).map(r=>Mve({...e,message:r})),Mve=t=>({verboseLine:DZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Dve(t);return Qf(e).replaceAll(" "," ".repeat(Fve))},Fve=2});var FZ,LZ=y(()=>{ps();Rl();FZ=(t,e)=>{Tl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var zZ,Lve,zve,Uve,UZ=y(()=>{ps();zZ=(t,e,r)=>{Uve(t);let n=Lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lve=t=>Tl({verbose:t})?zve++:void 0,zve=0n,Uve=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 qZ}from"node:process";var mb,PR,hb=y(()=>{mb=()=>qZ.bigint(),PR=t=>Number(qZ.bigint()-t)/1e6});var gb,CR=y(()=>{LZ();UZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=SZ(t,e),s=ER(r,"verbose"),a=zZ(s,o,{...r});return FZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VZ=v((wrt,ZZ)=>{ZZ.exports=GZ;GZ.sync=Hve;var HZ=Ge("fs");function qve(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{YZ.exports=KZ;KZ.sync=Bve;var WZ=Ge("fs");function KZ(t,e,r){WZ.stat(t,function(n,i){r(n,n?!1:JZ(i,e))})}function Bve(t,e){return JZ(WZ.statSync(t),e)}function JZ(t,e){return t.isFile()&&Gve(t,e)}function Gve(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 eV=v((krt,QZ)=>{var $rt=Ge("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=VZ():yb=XZ();QZ.exports=DR;DR.sync=Zve;function DR(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){DR(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 Zve(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aV=v((Ert,sV)=>{var Il=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tV=Ge("path"),Vve=Il?";":":",rV=eV(),nV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iV=(t,e)=>{let r=e.colon||Vve,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}},oV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tV.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];rV(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)},Wve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iV(t,e),o=[];for(let s=0;s{"use strict";var cV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};NR.exports=cV;NR.exports.default=cV});var pV=v((Trt,fV)=>{"use strict";var uV=Ge("path"),Kve=aV(),Jve=lV();function dV(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=Kve.sync(t.command,{path:r[Jve({env:r})],pathExt:e?uV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uV.resolve(i?t.options.cwd:"",s)),s}function Yve(t){return dV(t)||dV(t,!0)}fV.exports=Yve});var mV=v((Ort,MR)=>{"use strict";var jR=/([()\][%!^"`<>&|;, *?])/g;function Xve(t){return t=t.replace(jR,"^$1"),t}function Qve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(jR,"^$1"),e&&(t=t.replace(jR,"^$1")),t}MR.exports.command=Xve;MR.exports.argument=Qve});var gV=v((Rrt,hV)=>{"use strict";hV.exports=/^#!(.*)/});var _V=v((Irt,yV)=>{"use strict";var eSe=gV();yV.exports=(t="")=>{let e=t.match(eSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vV=v((Prt,bV)=>{"use strict";var FR=Ge("fs"),tSe=_V();function rSe(t){let r=Buffer.alloc(150),n;try{n=FR.openSync(t,"r"),FR.readSync(n,r,0,150,0),FR.closeSync(n)}catch{}return tSe(r.toString())}bV.exports=rSe});var $V=v((Crt,xV)=>{"use strict";var nSe=Ge("path"),SV=pV(),wV=mV(),iSe=vV(),oSe=process.platform==="win32",sSe=/\.(?:com|exe)$/i,aSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cSe(t){t.file=SV(t);let e=t.file&&iSe(t.file);return e?(t.args.unshift(t.file),t.command=e,SV(t)):t.file}function lSe(t){if(!oSe)return t;let e=cSe(t),r=!sSe.test(e);if(t.options.forceShell||r){let n=aSe.test(e);t.command=nSe.normalize(t.command),t.command=wV.command(t.command),t.args=t.args.map(o=>wV.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 uSe(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:lSe(n)}xV.exports=uSe});var AV=v((Drt,EV)=>{"use strict";var LR=process.platform==="win32";function zR(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 dSe(t,e){if(!LR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kV(t,e){return LR&&t===1&&!e.file?zR(e.original,"spawn"):null}function fSe(t,e){return LR&&t===1&&!e.file?zR(e.original,"spawnSync"):null}EV.exports={hookChildProcess:dSe,verifyENOENT:kV,verifyENOENTSync:fSe,notFoundError:zR}});var RV=v((Nrt,Pl)=>{"use strict";var TV=Ge("child_process"),UR=$V(),qR=AV();function OV(t,e,r){let n=UR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return qR.hookChildProcess(i,n),i}function pSe(t,e,r){let n=UR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||qR.verifyENOENTSync(i.status,n),i}Pl.exports=OV;Pl.exports.spawn=OV;Pl.exports.sync=pSe;Pl.exports._parse=UR;Pl.exports._enoent=qR});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 IV=y(()=>{});var PV=y(()=>{});import{promisify as mSe}from"node:util";import{execFile as hSe,execFileSync as zrt}from"node:child_process";import CV from"node:path";import{fileURLToPath as gSe}from"node:url";function bb(t){return t instanceof URL?gSe(t):t}function DV(t){return{*[Symbol.iterator](){let e=CV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=CV.resolve(e,"..")}}}var Hrt,Brt,NV=y(()=>{PV();Hrt=mSe(hSe);Brt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var ySe,_Se,bSe,jV,MV=y(()=>{IV();NV();ySe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&_Se(s,a,o),i&&bSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},_Se=(t,e,r)=>{for(let n of DV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},jV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=ySe(e),t}});var FV,ni,LV,zV,UV,Sb,ep,tp,Da=y(()=>{FV=(t,e,r)=>{let n=r?tp:ep,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},LV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zV=t=>Sb(t)&&UV in t,UV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",ep=class extends Error{};LV(ep,ep.name);tp=class extends Error{};LV(tp,tp.name)});var qV,vSe,HV,BV,GV=y(()=>{qV=()=>{let t=BV-HV+1;return Array.from({length:t},vSe)},vSe=(t,e)=>({name:`SIGRT${e+1}`,number:HV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),HV=34,BV=64});var ZV,VV=y(()=>{ZV=[{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 SSe}from"node:os";var HR,wSe,WV=y(()=>{VV();GV();HR=()=>{let t=qV();return[...ZV,...t].map(wSe)},wSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=SSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xSe}from"node:os";var $Se,kSe,KV,ESe,ASe,TSe,ant,JV=y(()=>{WV();$Se=()=>{let t=HR();return Object.fromEntries(t.map(kSe))},kSe=({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}],KV=$Se(),ESe=()=>{let t=HR(),e=65,r=Array.from({length:e},(n,i)=>ASe(i,t));return Object.assign({},...r)},ASe=(t,e)=>{let r=TSe(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}}},TSe=(t,e)=>{let r=e.find(({name:n})=>xSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},ant=ESe()});import{constants as rp}from"node:os";var XV,QV,e9,OSe,RSe,YV,ISe,BR,PSe,CSe,wb,np=y(()=>{JV();XV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QV=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return OSe(t,e);if(typeof t=="string")return ISe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${BR()}`)},OSe=(t,e)=>{if(YV.has(t))return YV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${BR()}`)},RSe=()=>new Map(Object.entries(rp.signals).reverse().map(([t,e])=>[e,t])),YV=RSe(),ISe=(t,e)=>{if(t in rp.signals)return t;throw t.toUpperCase()in rp.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${BR()}`)},BR=()=>`Available signal names: ${PSe()}. +Available signal numbers: ${CSe()}.`,PSe=()=>Object.keys(rp.signals).sort().map(t=>`'${t}'`).join(", "),CSe=()=>[...new Set(Object.values(rp.signals).sort((t,e)=>t-e))].join(", "),wb=t=>KV[t].description});import{setTimeout as DSe}from"node:timers/promises";var t9,NSe,r9,jSe,MSe,FSe,GR,xb=y(()=>{Da();np();t9=t=>{if(t===!1)return t;if(t===!0)return NSe;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},NSe=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jSe(s,a,r);MSe(l,n);let u=t(c);return FSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jSe=(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:QV(n),error:i}},MSe=(t,e)=>{t!==void 0&&e.reject(t)},FSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&GR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},GR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await DSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as LSe}from"node:events";var $b,ZR=y(()=>{$b=async(t,e)=>{t.aborted||await LSe(t,"abort",{signal:e})}});var n9,i9,zSe,VR=y(()=>{ZR();n9=({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)}`)},i9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zSe(t,e,n,i)],zSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Cl,USe,WR,o9,s9,kb,a9,c9,l9,u9,d9,f9,qSe,HSe,BSe,ii,GSe,ms,Dl,Nl=y(()=>{Cl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{USe(t,e,r),WR(t,e,n)},USe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},WR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},s9=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}),a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),u9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},d9=({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})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qSe=({code:t,message:e})=>HSe.has(t)||BSe.some(r=>e.includes(r)),HSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),BSe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${GSe(e)}${t}(${r})`,GSe=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 Ab,Ml,Ni,p9,ZSe,VSe,m9,WSe,h9,ip,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},Ml=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(m9(o,e,n,!1));return s},Ni=new WeakMap,p9=(t,e,r)=>{let n=ZSe(e,r);return VSe(n,e,r,t),n},ZSe=(t,e)=>{let r=AR(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(`"${ip(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. -${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}. +It is optional and defaults to "${i}".`)},VSe=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${ip(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(`"${ip(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ip(r)}" must not be ${e}. It must be a writable stream, not readable.`)},m9=(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}=WSe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${ip(n)}: ${Eb(e)}". +Please set this option with "pipe" instead.`},WSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=h9(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]}},h9=t=>t==="all"?1:t,ip=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as KSe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),KSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,KR,Rb,JR,g9,y9,op=y(()=>{Ob=(t,e)=>{e&&KR(t)},KR=t=>{t.refCounted()},Rb=(t,e)=>{e&&JR(t)},JR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(JR(t),JR(t))},y9=(t,e)=>{e&&(KR(t),KR(t))}});import{once as JSe}from"node:events";import{scheduler as YSe}from"node:timers/promises";var _9,b9,Ib,v9=y(()=>{Cb();op();Pb();Db();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(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 x9(t,n,i),await YSe.yield();let s=await S9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{YR();let o=Ib.get(t);for(;o?.length>0;)await JSe(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as XSe}from"node:events";var gs,Nb,QSe,jb,sp=y(()=>{v9();op();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new XSe;return n.connected=!0,Nb.set(t,n),QSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,QSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=_9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),g9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ewe}from"node:events";var k9,twe,E9,S9,w9,A9,Mb,rwe,Fb,T9,Pb=y(()=>{jl();Tb();Ub();Nl();sp();Cb();k9=({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:twe++,type:Fb,message:n,hasListeners:s}},twe=0n,E9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},S9=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:T9,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},w9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=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,rwe(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},rwe=async(t,e,{signal:r})=>{Na(t,1,r),await ewe(t,"disconnect",{signal:r}),c9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,ap,Lb,nwe,Cb=y(()=>{jl();xo();hs();Pb();O9=(t,e,r)=>{ap.has(t)||ap.set(t,new Set);let n=ap.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},R9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},x9=async(t,e,r)=>{for(;!Lb(t,e)&&ap.get(t)?.size>0;){let n=[...ap.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},ap=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>nwe(t),nwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as iwe}from"node:util";var zb,owe,QR,swe,XR,Ub=y(()=>{Nl();Cb();Pb();zb=({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}),owe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},owe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=k9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=O9(t,s,o);try{await QR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Dl(t),c}finally{R9(a)}},QR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=swe(t);try{await Promise.all([A9(n,t,r),o(n)])}catch(s){throw d9({error:s,methodName:e,isSubprocess:r}),f9({error:s,methodName:e,isSubprocess:r,message:i}),s}},swe=t=>{if(XR.has(t))return XR.get(t);let e=iwe(t.send.bind(t));return XR.set(t,e),e},XR=new WeakMap});import{scheduler as awe}from"node:timers/promises";var P9,C9,cwe,I9,$9,D9,YR,eI,Db=y(()=>{Ub();sp();Nl();P9=(t,e)=>{let r="cancelSignal";return WR(r,!1,t.connected),QR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),eI.signal),cwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){YR();return}gs(t,e,r),await awe.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(eI.abort(t.message),!0),D9="execa:ipc:cancel",YR=()=>{eI.abort(l9())},eI=new AbortController});var N9,j9,lwe,uwe,tI=y(()=>{ZR();Db();xb();N9=({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.")}},j9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=uwe(e);throw await P9(t,o),GR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uwe=({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 dwe}from"node:timers/promises";var M9,F9,fwe,rI=y(()=>{Da();M9=({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})`)},F9=(t,e,r,n)=>e===0||e===void 0?[]:[fwe(t,e,r,n)],fwe=async(t,e,r,{signal:n})=>{throw await dwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as pwe,execArgv as mwe}from"node:process";import L9 from"node:path";var z9,U9,nI=y(()=>{Al();z9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},U9=(t,e,{node:r=!1,nodePath:n=pwe,nodeOptions:i=mwe.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=L9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(L9.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 hwe}from"node:v8";var q9,gwe,ywe,_we,H9,iI=y(()=>{q9=({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`.");_we[r](t)}},gwe=t=>{try{hwe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ywe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_we={advanced:gwe,json:ywe},H9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,bwe,cn,oI,vwe,B9,qb,ja=y(()=>{G9=({encoding:t})=>{if(oI.has(t))return;let e=vwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to ${qb(e)}.`);let r=[...oI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to one of: ${r}.`)},bwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),oI=new Set([...bwe,...cn]),vwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in B9)return B9[e];if(oI.has(e))return e},B9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Swe}from"node:fs";import wwe from"node:path";import xwe from"node:process";var Z9,V9,W9,sI=y(()=>{Al();Z9=(t=V9())=>{let e=El(t,'The "cwd" option');return wwe.resolve(e)},V9=()=>{try{return xwe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},W9=(t,e)=>{if(e===V9())return t;let r;try{r=Swe(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?"":` -${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(` - -`);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 +${t}`}});import $we from"node:path";import K9 from"node:process";var J9,Hb,kwe,Ewe,aI=y(()=>{J9=wt(RV(),1);MV();xb();np();VR();tI();rI();nI();iI();ja();sI();Al();xo();Hb=(t,e,r)=>{r.cwd=Z9(r.cwd);let[n,i,o]=U9(t,e,r),{command:s,args:a,options:c}=J9.default._parse(n,i,o),l=bZ(c),u=kwe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=wR(u.shell),u.env=Ewe(u),u.killSignal=XV(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&$we.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kwe=({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}),Ewe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,cI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Fl(t){if(typeof t=="string")return Awe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Twe(t)}var Awe,Twe,Y9,Owe,X9,Rwe,lI=y(()=>{Awe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,Twe=t=>t.at(-1)===Owe?t.subarray(0,t.at(-2)===Rwe?-2:-1):t,Y9=` +`,Owe=Y9.codePointAt(0),X9="\r",Rwe=X9.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 uI(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 dI(t,e){return uI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function Q9(){return this[pI].next()}function eW(t){return this[pI].return(t)}function mI({preventCancel:t=!1}={}){let e=this.getReader(),r=new fI(e,t),n=Object.create(Pwe);return n[pI]=r,n}var Iwe,fI,pI,Pwe,tW=y(()=>{Iwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),fI=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}}},pI=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eW,"name",{value:"return"});Pwe=Object.create(Iwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eW}})});var rW=y(()=>{});var nW=y(()=>{tW();rW()});var iW,Cwe,Dwe,Nwe,cp,hI=y(()=>{Fa();nW();iW=t=>{if(Ma(t,{checkOpen:!1})&&cp.on!==void 0)return Dwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Cwe.call(t)==="[object ReadableStream]")return mI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Cwe}=Object.prototype,Dwe=async function*(t){let e=new AbortController,r={};Nwe(t,e,r);try{for await(let[n]of cp.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()}},Nwe=async(t,e,r)=>{try{await cp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},cp={}});var Ll,jwe,aW,oW,Mwe,sW,ji,lp=y(()=>{hI();Ll=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iW(t),u=e();u.length=0;try{for await(let d of l){let f=Mwe(d),p=r[f](d,u);aW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jwe({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}},jwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oW(c,e,i,o),new ji},oW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Mwe=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=sW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,up,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,up=()=>{},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 Ll(t,Uwe,e)}var Fwe,Lwe,zwe,Uwe,cW=y(()=>{lp();Wb();Fwe=()=>({contents:[]}),Lwe=()=>1,zwe=(t,{contents:e})=>(e.push(t),e),Uwe={init:Fwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Lwe,truncateChunk:up,addChunk:zwe,getFinalChunk:up,finalize:Gb}});async function Jb(t,e){return Ll(t,Jwe,e)}var qwe,Hwe,Bwe,lW,uW,Gwe,Zwe,Vwe,Wwe,fW,dW,Kwe,pW,Jwe,mW=y(()=>{lp();Wb();qwe=()=>({contents:new ArrayBuffer(0)}),Hwe=t=>Bwe.encode(t),Bwe=new TextEncoder,lW=t=>new Uint8Array(t),uW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gwe=(t,e)=>t.slice(0,e),Zwe=(t,{contents:e,length:r},n)=>{let i=pW()?Wwe(e,n):Vwe(e,n);return new Uint8Array(i).set(t,r),i},Vwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Wwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fW=t=>dW**Math.ceil(Math.log(t)/Math.log(dW)),dW=2,Kwe=({contents:t,length:e})=>pW()?t:t.slice(0,e),pW=()=>"resize"in ArrayBuffer.prototype,Jwe={init:qwe,convertChunk:{string:Hwe,buffer:lW,arrayBuffer:lW,dataView:uW,typedArray:uW,others:Zb},getSize:Vb,truncateChunk:Gwe,addChunk:Zwe,getFinalChunk:up,finalize:Kwe}});async function Xb(t,e){return Ll(t,txe,e)}var Ywe,Yb,Xwe,Qwe,exe,txe,hW=y(()=>{lp();Wb();Ywe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Xwe=(t,{contents:e})=>e+t,Qwe=(t,e)=>t.slice(0,e),exe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},txe={init:Ywe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:Qwe,addChunk:Xwe,getFinalChunk:exe,finalize:Gb}});var gW=y(()=>{cW();mW();hW();lp()});import{on as rxe}from"node:events";import{finished as nxe}from"node:stream/promises";var Qb=y(()=>{hI();gW();Object.assign(cp,{on:rxe,finished:nxe})});var yW,ixe,_W,bW,oxe,vW,SW,ev,La=y(()=>{Qb();So();xo();yW=({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=ixe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},ixe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_W=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},bW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=oxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},oxe=(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}},vW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),SW=(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 sxe}from"node:util";var xW,axe,cxe,lxe,uxe,dxe,wW,$W=y(()=>{lI();an();sI();lb();La();np();Da();xW=({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=axe({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=lxe(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=>uxe(D)).join(` +`)].map(D=>Qf(Fl(dxe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:R,message:T}},axe=({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=cxe(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?`${bW(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"},cxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lxe=(t,e)=>{if(t instanceof ni)return;let r=zV(t)?t.originalMessage:String(t?.message??t),n=Qf(W9(r,e));return n===""?void 0:n},uxe=t=>typeof t=="string"?t:sxe(t),dxe=t=>Array.isArray(t)?t.map(e=>Fl(wW(e))).filter(Boolean).join(` +`):wW(t),wW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,zl,dp,fxe,kW,pxe,fp=y(()=>{np();hb();Da();$W();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kW({command:t,escapedCommand:e,cwd:o,durationMs:PR(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})=>dp({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}),dp=({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}=pxe(l,u),{originalMessage:T,shortMessage:D,message:E}=xW({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=FV(t,E,x);return Object.assign(ae,fxe({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},fxe=({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})=>kW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:PR(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:[]}),kW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pxe=(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 mxe(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(EW(t*1e3)%1e3),nanoseconds:Math.trunc(EW(t*1e6)%1e3)}}function hxe(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 gI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mxe(t);break}case"bigint":return hxe(t)}throw new TypeError("Expected a finite number or bigint")}var EW,AW=y(()=>{EW=t=>Number.isFinite(t)?t:0});function yI(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+_xe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gxe(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?" "+yxe(d,u):f;i.push(p)}},a=gI(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%bxe):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 gxe,yxe,_xe,bxe,TW=y(()=>{AW();gxe=t=>t===0||t===0n,yxe=(t,e)=>e===1||e===1n?t:`${t}s`,_xe=1e-7,bxe=24n*60n*60n*1000n});var OW,RW=y(()=>{Rl();OW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IW,vxe,PW=y(()=>{TW();ps();Rl();RW();IW=(t,e)=>{Tl(e)&&(OW(t,e),vxe(t,e))},vxe=(t,e)=>{let r=`(done in ${yI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ul,rv=y(()=>{PW();Ul=(t,e,{reject:r})=>{if(IW(t,e),t.failed&&r)throw t;return t}});var NW,Sxe,wxe,jW,MW,CW,xxe,_I,DW,za,FW,$xe,nv,LW,kxe,Exe,bI,zW,Axe,UW,iv,Txe,vI,Oxe,Rxe,qW,Cn,ov,SI,HW,BW,ys,$r=y(()=>{Fa();bo();an();NW=(t,e)=>za(t)?"asyncGenerator":FW(t)?"generator":nv(t)?"fileUrl":kxe(t)?"filePath":Txe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Oxe(t)?"asyncIterable":Rxe(t)?"iterable":vI(t)?jW({transform:t},e):$xe(t)?Sxe(t,e):"native",Sxe=(t,e)=>dI(t.transform,{checkOpen:!1})?wxe(t,e):vI(t.transform)?jW(t,e):xxe(t,e),wxe=(t,e)=>(MW(t,e,"Duplex stream"),"duplex"),jW=(t,e)=>(MW(t,e,"web TransformStream"),"webTransform"),MW=({final:t,binary:e,objectMode:r},n,i)=>{CW(t,`${n}.final`,i),CW(e,`${n}.binary`,i),_I(r,`${n}.objectMode`)},CW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(dI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(vI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return _I(r,`${i}.binary`),_I(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},_I=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DW=t=>za(t)||FW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$xe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",LW=t=>nv(t)&&t.protocol!=="file:",kxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Exe.has(e))&&bI(t.file),Exe=new Set(["file","append"]),bI=t=>typeof t=="string",zW=(t,e)=>t==="native"&&typeof e=="string"&&!Axe.has(e),Axe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Txe=t=>UW(t)||iv(t),vI=t=>UW(t?.readable)&&iv(t?.writable),Oxe=t=>qW(t)&&typeof t[Symbol.asyncIterator]=="function",Rxe=t=>qW(t)&&typeof t[Symbol.iterator]=="function",qW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),SI=new Set(["fileUrl","filePath"]),HW=new Set([...SI,"webStream","nodeStream"]),BW=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 wI,Ixe,Pxe,GW,xI=y(()=>{$r();wI=(t,e,r,n)=>n==="output"?Ixe(t,e,r):Pxe(t,e,r),Ixe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pxe=(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}},GW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZW,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,VW=y(()=>{bo();ja();$r();xI();ZW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Cxe(t,e,r,n)],Cxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fxe(o,r)},Dxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nxe({stdioItem:t,optionName:i}):e==="webTransform"?jxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nxe=({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}}},jxe=({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}=wI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Mxe=({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}=wI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Fxe=(t,e)=>e==="input"?t.reverse():t});import $I from"node:process";var WW,Lxe,zxe,ql,kI,KW,Uxe,qxe,JW=y(()=>{Fa();$r();WW=(t,e,r)=>{let n=t.map(i=>Lxe(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)??qxe},Lxe=({type:t,value:e},r)=>zxe[r]??KW[t](e),zxe=["input","output","output"],ql=()=>{},kI=()=>"input",KW={generator:ql,asyncGenerator:ql,fileUrl:ql,filePath:ql,iterable:kI,asyncIterable:kI,uint8Array:kI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?uI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:ql,duplex:ql,native(t){let e=Uxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return KW.nodeStream(t)}},Uxe=t=>{if([0,$I.stdin].includes(t))return"input";if([1,2,$I.stdout,$I.stderr].includes(t))return"output"},qxe="output"});var YW,XW=y(()=>{YW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QW,Hxe,Bxe,eK,Gxe,Zxe,tK=y(()=>{So();XW();ps();QW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Hxe(t,n).map((a,c)=>eK(a,c));return o?Gxe(s,r,i):YW(s,e)},Hxe=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(Bxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},Bxe=t=>Pn.some(e=>t[e]!==void 0),eK=(t,e)=>Array.isArray(t)?t.map(r=>eK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),Gxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Ol(r,i)&&Zxe(n)?"ignore":n),Zxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vxe}from"node:fs";import Wxe from"node:tty";var nK,Kxe,Jxe,Yxe,Xxe,rK,iK=y(()=>{Fa();So();an();hs();nK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kxe({stdioItem:t,fdNumber:n,direction:i}):Xxe({stdioItem:t,fdNumber:n}),Kxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jxe({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},Jxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Yxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wxe.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(Vxe(i)),optionName:e}}},Yxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},Xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rK=(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 oK,Qxe,e0e,t0e,r0e,sK=y(()=>{Fa();an();$r();oK=({input:t,inputFile:e},r)=>r===0?[...Qxe(t),...t0e(e)]:[],Qxe=t=>t===void 0?[]:[{type:e0e(t),value:t,optionName:"input"}],e0e=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.")},t0e=t=>t===void 0?[]:[{...r0e(t),optionName:"inputFile"}],r0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(bI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aK,cK,n0e,i0e,lK,o0e,s0e,uK,dK=y(()=>{$r();aK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=n0e(i,t);if(s.length!==0){if(o){i0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(HW.has(t))return lK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});BW.has(t)&&s0e({otherStdioItems:s,type:t,value:e,optionName:r})}},n0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),i0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{SI.has(e)&&lK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>o0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uK(s,n,e),i==="output"?o[0].stream:void 0},o0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,s0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uK(i,n,e)},uK=(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,a0e,c0e,l0e,u0e,d0e,f0e,p0e,m0e,h0e,g0e,y0e,EI,_0e,av=y(()=>{So();VW();xI();$r();JW();tK();iK();sK();dK();sv=(t,e,r,n)=>{let o=QW(e,r,n).map((a,c)=>a0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=h0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_0e(a)),s},a0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=c0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WW(o,e,i),c=o.map(d=>nK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZW(c,i,a,r),u=GW(l,a);return m0e(l,u),{direction:a,objectMode:u,stdioItems:l}},c0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>l0e(c,n)),...oK(r,e)],s=aK(o),a=s.length>1;return u0e(s,a,n),f0e(s),{stdioItems:s,isStdioArray:a}},l0e=(t,e)=>({type:NW(t,e),value:t,optionName:e}),u0e=(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(d0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},d0e=new Set(["ignore","ipc"]),f0e=t=>{for(let e of t)p0e(e)},p0e=({type:t,value:e,optionName:r})=>{if(LW(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(zW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},m0e=(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.`)},h0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(g0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw EI(i),o}},g0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>y0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},y0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},EI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},_0e=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 fK}from"node:fs";var mK,Mi,b0e,hK,pK,v0e,gK=y(()=>{an();av();$r();mK=(t,e)=>sv(v0e,t,e,!0),Mi=({type:t,optionName:e})=>{hK(e,ys[t])},b0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hK(t,`"${e}"`),{}),hK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:b0e},v0e={input:{...pK,fileUrl:({value:t})=>({contents:[vo(fK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(fK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pK,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,AI,pp=y(()=>{lI();ko=(t,{stripFinalNewline:e},r)=>AI(e,r)&&t!==void 0&&!Array.isArray(t)?Fl(t):t,AI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,OI,yK,_K,S0e,w0e,x0e,bK,$0e,TI,k0e,E0e,A0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:_K(e,n),OI=(t,e,r)=>r?t.flatMap(n=>yK(n,e)):yK(t,e),yK=(t,e)=>{let{transform:r,final:n}=_K(e,{});return[...r(t),...n()]},_K=(t,e)=>(e.previousChunks="",{transform:S0e.bind(void 0,e,t),final:x0e.bind(void 0,e)}),S0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=TI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=TI(n,r.slice(i+1))),t.previousChunks=n},w0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),x0e=function*({previousChunks:t}){t.length>0&&(yield t)},bK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$0e.bind(void 0,n)},$0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?k0e:A0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},TI=(t,e)=>`${t}${e}`,k0e={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:TI},E0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},A0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:E0e}});import{Buffer as T0e}from"node:buffer";var vK,O0e,SK,R0e,I0e,wK,xK=y(()=>{an();vK=(t,e)=>t?void 0:O0e.bind(void 0,e),O0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!T0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SK=(t,e)=>t?R0e.bind(void 0,e):I0e.bind(void 0,e),R0e=function*(t,e){wK(t,e),yield e},I0e=function*(t,e){if(wK(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},wK=(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 P0e}from"node:buffer";import{StringDecoder as C0e}from"node:string_decoder";var uv,D0e,N0e,j0e,RI=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:D0e.bind(void 0,new TextEncoder)};let n=new C0e(e);return{transform:N0e.bind(void 0,n),final:j0e.bind(void 0,n)}},D0e=function*(t,e){P0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},N0e=function*(t,e){yield qt(e)?t.write(e):e},j0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $K}from"node:util";var II,dv,kK,M0e,EK,F0e,AK=y(()=>{II=$K(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=F0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},kK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M0e(r,Number(e),t)},M0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},EK=$K(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),F0e=function*(t){yield t}});var PI,TK,Ua,mp,L0e,z0e,CI=y(()=>{PI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...mp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=z0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},mp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*L0e(r,Number(e),t)},L0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},z0e=function*(t){yield t}});import{Transform as U0e,getDefaultHighWaterMark as OK}from"node:stream";var DI,fv,RK,pv=y(()=>{$r();lv();xK();RI();AK();CI();DI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RK(t,s,o),l=za(e),u=za(r),d=l?II.bind(void 0,dv,a):PI.bind(void 0,Ua),f=l||u?II.bind(void 0,kK,a):PI.bind(void 0,mp),p=l||u?EK.bind(void 0,a):void 0;return{stream:new U0e({writableObjectMode:n,writableHighWaterMark:OK(n),readableObjectMode:i,readableHighWaterMark:OK(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=RK(s,r,a);t=TK(c,t)}return t},RK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:SK(i,a)},bK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IK,q0e,H0e,B0e,G0e,PK=y(()=>{pv();an();$r();IK=(t,e)=>{for(let r of q0e(t))H0e(t,r,e)},q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),H0e=(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=>B0e(a,n));r.input=Xf(s)},B0e=(t,e)=>{let r=fv(t,e,"utf8",!0);return G0e(r),Xf(r)},G0e=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,Z0e,V0e,CK,DK,W0e,NK,NI=y(()=>{ja();$r();Rl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ol(r,n)&&!cn.has(e)&&Z0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&V0e.has(o))||t.every(({type:i})=>Cn.has(i))),Z0e=t=>t===1||t===2,V0e=new Set(["pipe","overlapped"]),CK=async(t,e,r,n)=>{for await(let i of t)W0e(e)||NK(i,r,n)},DK=(t,e,r)=>{for(let n of t)NK(n,e,r)},W0e=t=>t._readableState.pipes.length>0,NK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as K0e,appendFileSync as J0e}from"node:fs";var jK,Y0e,X0e,Q0e,e$e,t$e,MK=y(()=>{NI();pv();lv();an();$r();La();jK=({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)=>Y0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Y0e=({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=SW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=X0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Q0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});e$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&&t$e(b,m,i),S}catch(x){return n.error=x,S}},X0e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},Q0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Xf(t)};let s=dZ(t,r);return n[o]?{serializedResult:s,finalResult:OI(s,!i[o],e)}:{serializedResult:s}},e$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=OI(t,!1,s);try{DK(a,e,n)}catch(c){r.error??=c}},t$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)?J0e(n,t):(r.add(o),K0e(n,t))}}});var FK,LK=y(()=>{an();pp();FK=([,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)?$R([t,e]):`${t}${e}`}});import{once as jI}from"node:events";var zK,r$e,UK,qK,n$e,MI,FI=y(()=>{Da();zK=async(t,e)=>{let[r,n]=await r$e(t);return e.isForcefullyTerminated??=!1,[r,n]},r$e=async t=>{let[e,r]=await Promise.allSettled([jI(t,"spawn"),jI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UK(t):r.value},UK=async t=>{try{return await jI(t,"exit")}catch{return UK(t)}},qK=async t=>{let[e,r]=await t;if(!n$e(e,r)&&MI(e,r))throw new ni;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,MI=(t,e)=>t!==0||e!==null});var HK,i$e,BK=y(()=>{Da();La();FI();HK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=vW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:MI(e,r)?new ni:void 0});import{spawnSync as o$e}from"node:child_process";var GK,s$e,a$e,c$e,hv,l$e,u$e,d$e,f$e,ZK=y(()=>{CR();aI();cI();fp();rv();gK();pp();PK();MK();La();LK();BK();GK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=s$e(t,e,r),d=l$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ul(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);c$e(u);let d=mK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},a$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,c$e=({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.`)},l$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=u$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}=HK(c,r),{output:m,error:h=l}=jK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(FK(m,r),r,"all");return f$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},u$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IK(o,r);let a=d$e(r);return o$e(...Bb(t,e,a))}catch(a){return zl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},d$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),f$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?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):dp({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 LI,on as p$e}from"node:events";var VK,m$e,h$e,g$e,y$e,WK=y(()=>{Nl();sp();op();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Cl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),m$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),m$e=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([h$e(o,n,s),g$e(o,r,s),y$e(o,r,s)])}catch(a){throw Dl(t),a}finally{s.abort(),Rb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await LI(t,"message",{signal:r});return n}for await(let[n]of p$e(t,"message",{signal:r}))if(e(n))return n},g$e=async(t,e,{signal:r})=>{await LI(t,"disconnect",{signal:r}),o9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await LI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as JK,on as _$e}from"node:events";var YK,zI,b$e,v$e,S$e,KK,UI=y(()=>{Nl();sp();op();YK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>zI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),zI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Cl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Ob(e,o);let s=gs(t,e,r),a=new AbortController,c={};return b$e(t,s,a),v$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),S$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},b$e=async(t,e,r)=>{try{await JK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},S$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 _$e(r,"message",{signal:o.signal}))KK(s),yield c}catch{KK(s)}finally{o.abort(),Rb(e,a),n||Dl(t),i&&await t}},KK=({error:t})=>{if(t)throw t}});import XK from"node:process";var QK,e3,t3,qI=y(()=>{Ub();WK();UI();Db();QK=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XK,e=!0,r=XK.channel!==void 0;return{...t3(t,e,r),getCancelSignal:C9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},t3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as w$e}from"node:child_process";import{PassThrough as x$e,Readable as $$e,Writable as k$e,Duplex as E$e}from"node:stream";var r3,A$e,hp,T$e,O$e,R$e,I$e,n3=y(()=>{av();fp();rv();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{EI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=zl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=I$e(c,s,i);return{subprocess:a,promise:l}},A$e=(t,e)=>{let r=hp(),n=hp(),i=hp(),o=Array.from({length:e.length-3},hp),s=hp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},hp=()=>{let t=new x$e;return t.end(),t},T$e=()=>new $$e({read(){}}),O$e=()=>new k$e({write(){}}),R$e=()=>new E$e({read(){},write(){}}),I$e=async(t,e,r)=>Ul(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as gp,Writable as C$e,Duplex as D$e}from"node:stream";var a3,yp,s3,N$e,c3=y(()=>{pv();av();$r();a3=(t,e)=>sv(N$e,t,e,!1),yp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},s3={fileNumber:yp,generator:DI,asyncGenerator:DI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:D$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},N$e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:gp.fromWeb(t)}),iterable:({value:t})=>({stream:gp.from(t)}),asyncIterable:({value:t})=>({stream:gp.from(t)}),string:({value:t})=>({stream:gp.from(t)}),uint8Array:({value:t})=>({stream:gp.from(P$e.from(t))})},output:{...s3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t,append:e}})=>({stream:o3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:yp,asyncIterable:yp,string:yp,uint8Array:yp}}});import{on as j$e,once as l3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as f3}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)BI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new HI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,HI,z$e,U$e,q$e,BI,H$e,B$e,G$e,Z$e,V$e,p3,m3,GI,h3,W$e,gv,u3,d3,yv=y(()=>{L$e=(t,e)=>{if(t.length===0)return F$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},HI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(BI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=H$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(BI(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)}},z$e=async(t,e,r)=>{gv(t,u3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),gv(t,-u3)}},U$e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},q$e=async(t,e,r,{signal:n})=>{for await(let[i]of j$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},BI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},H$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,d3);let a=new AbortController;try{await Promise.race([B$e(o,e,a),G$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Z$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?GI(t):V$e(t))},B$e=async(t,e,{signal:r})=>{try{await t,r.aborted||GI(e)}catch(n){r.aborted||p3(e,n)}},G$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await f3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;m3(s)?i.add(e):h3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await l3(t,i,{signal:o}),!t.readable)return l3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?GI(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",GI=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},u3=2,d3=1});import{finished as g3}from"node:stream/promises";var Hl,K$e,ZI,J$e,VI,_v=y(()=>{So();Hl=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}ZI(e)}},ZI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}VI(t)}},VI=t=>{t.readable&&t.destroy()}});var y3,Y$e,X$e,Q$e,eke,tke,_3=y(()=>{yv();So();Tb();$r();_v();y3=(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})=>Cn.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))Q$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)}},Y$e=(t,e,r,n)=>{r==="output"?Hl(t.stdio[n],e):Hl(e,t.stdio[n]);let i=X$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},X$e=["stdin","stdout","stderr"],Q$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;eke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},eke=(t,{signal:e})=>{ri(t)&&Na(t,tke,e)},tke=2});var Ha,b3=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 bv,WI,KI,rke,JI,vv,nke,YI,XI,QI,v3,Bct,Gct,S3=y(()=>{b3();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",WI=Symbol.for("signal-exit emitter"),KI=globalThis,rke=Object.defineProperty.bind(Object),JI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(KI[WI])return KI[WI];rke(KI,WI,{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{},nke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),YI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},XI=class extends vv{#t=QI.platform==="win32"?"SIGINT":"SIGHUP";#r=new JI;#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(!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 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 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)}},QI=globalThis.process,{onExit:v3,load:Bct,unload:Gct}=nke(bv(QI)?new XI(QI):new YI)});import{addAbortListener as ike}from"node:events";var w3,x3=y(()=>{S3();w3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=v3(()=>{t.kill()});ike(n,()=>{i()})}});var k3,oke,ske,$3,ake,E3=y(()=>{xR();hb();hs();Al();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=oke(r,n,i),{sourceStream:d,sourceError:f}=ake(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}},oke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ske(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ske=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||SR(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($3)(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}`)},$3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ake=(t,e)=>{try{return{sourceStream:Ml(t,e)}}catch(r){return{sourceError:r}}}});var T3,cke,eP,A3,tP=y(()=>{fp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=cke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw eP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},cke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return VI(t),n;if(e!==void 0)return ZI(r),e},eP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zl({error:t,command:A3,escapedCommand:A3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),A3="source.pipe(destination)"});var O3,R3=y(()=>{O3=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 lke}from"node:stream/promises";var I3,uke,dke,fke,Sv,pke,mke,P3=y(()=>{yv();Tb();_v();I3=(t,e,r)=>{let n=Sv.has(e)?dke(t,e):uke(t,e);return Na(t,pke,r.signal),Na(e,mke,r.signal),fke(e),n},uke=(t,e)=>{let r=qa([t]);return Hl(r,e),Sv.set(e,r),r},dke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},fke=async t=>{try{await lke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,pke=2,mke=1});import{aborted as hke}from"node:util";var C3,gke,D3=y(()=>{tP();C3=(t,e)=>t===void 0?[]:[gke(t,e)],gke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await hke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw eP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,yke,_ke,N3=y(()=>{bo();E3();tP();R3();P3();D3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=yke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},yke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_ke(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=I3(e,o,d);return await Promise.race([O3(u),...C3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_ke=(t,e)=>Promise.allSettled([t,e])});import{on as bke}from"node:events";import{getDefaultHighWaterMark as vke}from"node:stream";var xv,Ske,rP,wke,M3,nP,j3,xke,$ke,$v=y(()=>{RI();lv();CI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Ske(e,s),M3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Ske=async(t,e)=>{try{await t}catch{}finally{e.abort()}},rP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;wke(e,s,t);let a=t.readableObjectMode&&!o;return M3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},wke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},M3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=bke(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return xke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},nP=vke(!0),j3=nP,xke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$ke({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*mp(a)}},$ke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as kke}from"node:timers/promises";var F3,Eke,Ake,Tke,iP,L3,oP=y(()=>{Qb();an();NI();$v();La();pp();F3=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=Eke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Ake(t),d]);return}let f=AI(c,r),p=rP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Tke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Eke=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=rP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CK(a,t,r,o)},Ake=async t=>{await kke(),t.readableFlowing===null&&t.resume()},Tke=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 L3(yW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},iP=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lZ(t)?new Uint8Array(t):t});import{finished as Oke}from"node:stream/promises";var _p,Rke,Ike,Pke,Cke,Dke,sP,kv,z3,Ev=y(()=>{_p=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Oke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Cke(a,e,r,n)}finally{s.abort()}},Rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ike(t,r,n),n},Ike=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Pke(e,r),n.call(t,...i)}},Pke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Cke=(t,e,r,n)=>{if(!Dke(t,e,r,n))throw t},Dke=(t,e,r,n=!0)=>r.propagating?z3(t)||kv(t):(r.propagating=!0,sP(r,e)===n?z3(t):kv(t)),sP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,aP,cP=y(()=>{oP();Ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>aP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),aP=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=_p(t,e,l);if(sP(l,e)){await u;return}let[d]=await Promise.all([F3({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 q3,H3,Nke,jke,lP=y(()=>{yv();cP();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>aP({...Nke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:jke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Nke=({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}},jke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var B3,G3,Z3=y(()=>{Rl();ps();B3=t=>Ol(t,"ipc"),G3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{La();Z3();xo();UI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=B3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of zI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_W(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Mke}from"node:events";var J3,Fke,Lke,zke,Y3=y(()=>{Fa();rI();VR();tI();So();$r();oP();K3();iI();lP();cP();FI();Ev();J3=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 _=zK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=U3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Fke(h,t,S),D=Lke(m,S);try{return await Promise.race([Promise.all([{},qK(_),Promise.all(x),w,A,H9(t,d),...T,...D]),g,zke(t,b),...F9(t,o,f,b),...i9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...j9({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=>iP(ae))),iP(w),W3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Fke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_p(n,i,r)),Lke=(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})=>_p(s,n,e,{isSameDirection:Cn.has(i),stopOnExit:i==="native"}))),zke=async(t,{signal:e})=>{let[r]=await Mke(t,"error",{signal:e});throw r}});var X3,bp,Bl,Av=y(()=>{jl();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),bp=(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 Q3}from"node:stream/promises";var uP,eJ,dP,fP,Tv,Ov,pP=y(()=>{Ev();uP=async t=>{if(t!==void 0)try{await dP(t)}catch{}},eJ=async t=>{if(t!==void 0)try{await fP(t)}catch{}},dP=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},fP=async t=>{await Q3(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 Uke}from"node:stream";import{callbackify as qke}from"node:util";var tJ,mP,hP,gP,Hke,yP,_P,rJ,bP=y(()=>{ja();hs();$v();jl();Av();pP();tJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=mP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=hP(a,s),{read:f,onStdoutDataDone:p}=gP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Uke({read:f,destroy:qke(_P.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return yP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},mP=(t,e,r)=>{let n=Ml(t,e),i=bp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},hP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:nP},gP=({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(){Hke(this,s,o)},onStdoutDataDone:o}},Hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},yP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await fP(t),await n,await uP(i),await e,r.readable&&r.push(null)}catch(o){await uP(i),rJ(r,o)}},_P=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(rJ(t,n),await Tv(e,n))},rJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as Bke}from"node:stream";import{callbackify as nJ}from"node:util";var iJ,vP,SP,Gke,Zke,wP,xP,oJ,$P=y(()=>{hs();Av();pP();iJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=vP(t,r,e),s=new Bke({...SP(n,t,i),destroy:nJ(xP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return wP(n,s),s},vP=(t,e,r)=>{let n=Ab(t,e),i=bp(r,n,"writableFinal"),o=bp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},SP=(t,e,r)=>({write:Gke.bind(void 0,t),final:nJ(Zke.bind(void 0,t,e,r))}),Gke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Zke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},wP=async(t,e,r)=>{try{await dP(t),e.writable&&e.end()}catch(n){await eJ(r),oJ(e,n)}},xP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(oJ(t,i),await Tv(e,i))},oJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as Vke}from"node:stream";import{callbackify as Wke}from"node:util";var sJ,Kke,aJ=y(()=>{ja();bP();$P();sJ=({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}=mP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=vP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=hP(c,a),{read:g,onStdoutDataDone:b}=gP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Vke({read:g,...SP(u,t,d),destroy:Wke(Kke.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 yP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),wP(u,_,c),_},Kke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([_P({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),xP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var kP,Jke,cJ=y(()=>{ja();hs();$v();kP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ml(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Jke(a,s,t)},Jke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lJ,uJ=y(()=>{Av();bP();$P();aJ();cJ();lJ=(t,{encoding:e})=>{let r=X3();t.readable=tJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=kP.bind(void 0,t,e),t[Symbol.asyncIterator]=kP.bind(void 0,t,e,{})}});var dJ,Yke,Xke,fJ=y(()=>{dJ=(t,e)=>{for(let[r,n]of Xke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Yke=(async()=>{})().constructor.prototype,Xke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Yke,t)])});import{setMaxListeners as Qke}from"node:events";import{spawn as eEe}from"node:child_process";var pJ,tEe,rEe,nEe,iEe,oEe,mJ=y(()=>{Qb();CR();aI();hs();cI();qI();fp();rv();n3();c3();pp();_3();xb();x3();N3();lP();Y3();uJ();jl();fJ();pJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tEe(t,e,r),{subprocess:f,promise:p}=nEe({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}),dJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},tEe=(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=rEe(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rEe=({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}},nEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eEe(...Bb(t,e,r))}catch(m){return r3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Qke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Di();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lJ(c,r),QK(c,r);let p=iEe({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}},iEe=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 J3({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=oEe({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)},oEe=({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?dp({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,sEe,aEe,hJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,sEe(n,t[n],i)]));return{...t,...r}},sEe=(t,e,r)=>aEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,aEe=new Set(["env",...TR])});var _s,cEe,lEe,gJ=y(()=>{bo();xR();yZ();ZK();mJ();hJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>cEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cEe=({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}=lEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GK(a,c,l):pJ(a,c,l,i)},lEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hZ(e)?gZ(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 yJ,_J,bJ,uEe,dEe,vJ=y(()=>{yJ=({file:t,commandArguments:e})=>bJ(t,e),_J=({file:t,commandArguments:e})=>({...bJ(t,e),isSync:!0}),bJ=(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]=uEe(t);return{file:r,commandArguments:n}},uEe=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(dEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dEe=/ +/g});var SJ,wJ,fEe,xJ,pEe,$J,kJ=y(()=>{SJ=(t,e,r)=>{t.sync=e(fEe,r),t.s=t.sync},wJ=({options:t})=>xJ(t),fEe=({options:t})=>({...xJ(t),isSync:!0}),xJ=t=>({options:{...pEe(t),...t}}),pEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$J={preferLocal:!0}});var Ddt,Ke,Ndt,jdt,Mdt,Fdt,Ldt,zdt,Udt,qdt,zr=y(()=>{gJ();vJ();nI();kJ();qI();Ddt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),Ndt=_s(yJ),jdt=_s(_J),Mdt=_s(z9),Fdt=_s(wJ,{},$J,SJ),{sendMessage:Ldt,getOneMessage:zdt,getEachMessage:Udt,getCancelSignal:qdt}=e3()});import{existsSync as Iv,statSync as mEe}from"node:fs";import{dirname as EP,extname as hEe,isAbsolute as EJ,join as AP,relative as TP,resolve as Pv,sep as gEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function yEe(t){return(Iv(AP(t,"build.gradle.kts"))||Iv(AP(t,"build.gradle")))&&Iv(AP(t,"gradle.properties"))}function _Ee(t,e){let n=TP(t,e).split(gEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bEe(t,e){let r=Pv(t,e),n=r;Iv(r)?mEe(r).isFile()&&(n=EP(r)):hEe(r)!==""&&(n=EP(r));let i=TP(t,n);if(i.startsWith("..")||EJ(i))return null;let o=n;for(;;){if(yEe(o))return o;if(Pv(o)===Pv(t))return null;let s=EP(o);if(s===o)return null;let a=TP(t,s);if(a.startsWith("..")||EJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=bEe(r,o);if(!s){i.push(o);continue}let a=_Ee(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 RP,readFileSync as vEe}from"node:fs";import{join as Gl}from"node:path";function Zl(t="."){let e=Gl(t,".cladding","config.yaml");if(!RP(e))return OP;try{let n=(0,AJ.parse)(vEe(e,"utf8"))?.gate;if(!n)return OP;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 SEe){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 OP}}function TJ(t="."){let e=Zl(t).testReport,r=e?[e,...IP]:IP;return[...new Set(r.map(n=>Gl(t,n)))]}function OJ(t="."){let e=Zl(t).testReport;if(e){let r=Gl(t,e);return RP(r)?r:null}return IP.map(r=>Gl(t,r)).find(r=>RP(r))??null}function RJ(t,e){let r=[],n=!1;for(let i of t){let o=wEe.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 AJ,SEe,OP,IP,wEe,vp=y(()=>{"use strict";AJ=wt(tr(),1);Nv();SEe=["type","lint","test","coverage"],OP={scope:"feature"},IP=["test-report.junit.xml",Gl("coverage","junit.xml"),Gl(".cladding","test-report.junit.xml")];wEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as CP,readFileSync as IJ,readdirSync as xEe,statSync as $Ee}from"node:fs";import{join as jv}from"node:path";function jP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(CP(r))try{if(PJ.test(IJ(r,"utf8")))return!0}catch{}}return!1}function CJ(t){try{return CP(t)&&PJ.test(IJ(t,"utf8"))}catch{return!1}}function DJ(t,e=0){if(e>4||!CP(t))return!1;let r;try{r=xEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=$Ee(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CJ(i))return!0}return!1}function AEe(t){if(jP(t))return!0;for(let e of kEe)if(CJ(jv(t,e)))return!0;for(let e of EEe)if(DJ(jv(t,e)))return!0;return!1}function NJ(t="."){let e=Zl(t).coverage;return e||(AEe(t)?"kover":"jacoco")}function jJ(t="."){return DP[NJ(t)]}function MJ(t="."){return PP[NJ(t)]}var DP,PP,NP,PJ,kEe,EEe,Mv=y(()=>{"use strict";vp();DP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},PP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},NP=[PP.kover,PP.jacoco],PJ=/kover/i;kEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],EEe=["buildSrc","build-logic"]});import{existsSync as wp,readFileSync as FP,readdirSync as LJ,statSync as TEe}from"node:fs";import{dirname as OEe,join as kr,resolve as REe}from"node:path";import Vl from"node:process";function LP(t){return wp(kr(t,"gradlew"))?"./gradlew":"gradle"}function IEe(t){let e=LP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function PEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(FP(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 DEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function MEe(t,e){for(let r of e)if(wp(kr(t,r)))return r}function FEe(t,e){try{return LJ(t).find(n=>n.endsWith(e))}catch{return}}function qEe(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=REe(t);;){e.push(kr(o,".madgerc"));let s=OEe(o);if(s===o)break;o=s}let i=Vl.env.MADGE_config??Vl.env.madge_config;return i&&e.push(i),e}function HEe(){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 zJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function GEe(t){try{return TEe(t).isFile()}catch{return!1}}function ZEe(t){let e;try{e=FP(t,"utf8")}catch{return!0}try{return zJ(JSON.parse(e).excludeRegExp)}catch{return BEe.test(e)}}function VEe(t,e){let r=e.madge;return r&&typeof r=="object"&&zJ(r.excludeRegExp)||HEe()?!0:qEe(t).some(n=>GEe(n)&&ZEe(n))}function WEe(t){try{return JSON.parse(FP(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 FJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function KEe(t,e,r){if(VEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",UEe),{...e,args:n}}function JEe(t,e,r){if(Sp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of LEe)if(n.configs.some(i=>wp(kr(t,i))))return n.gate;if(zEe.some(n=>wp(kr(t,n)))||r.eslintConfig!==void 0)return e}function XEe(t,e){return YEe.some(r=>wp(kr(t,r)))?!0:e.jest!==void 0}function QEe(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 MP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function eAe(t,e){let r=WEe(t),n=e.lint?JEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:KEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:MP(i,"lint"),s=Sp(r,"test"),a=s?QEe(s):void 0;return s&&!a?(o=MP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...Sp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&XEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!Sp(r,"coverage")&&!FJ(r,"@vitest/coverage-v8")&&!FJ(r,"@vitest/coverage-istanbul")?o=MP(o,"coverage"):a==="vitest"&&Sp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of NEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=FEe(t,o):r=MEe(t,[o]),r)break;if(!r||e.requiresSource&&!DEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?eAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return jEe}var Fi,CEe,NEe,jEe,LEe,zEe,UEe,BEe,YEe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];CEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);NEe=[{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:IEe},{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:PEe}],jEe={language:"unknown",manifest:"",gates:{}};LEe=[{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"]}}],zEe=["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"],UEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";BEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;YEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as tAe,readFileSync as rAe}from"node:fs";import{join as nAe}from"node:path";function Ba(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 UJ.test(o)||UJ.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??"")} ${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)} -`,"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+=` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Wl(t,e){let r=nAe(t,"package.json");if(!tAe(r))return!1;try{return!!JSON.parse(rAe(r,"utf8")).scripts?.[e]}catch{return!1}}var UJ,Nn=y(()=>{"use strict";UJ=/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 iAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:iAe}});function oAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:oAe}});import{existsSync as zP,readdirSync as qJ}from"node:fs";import{join as Hv}from"node:path";function aAe(t,e){let r=Hv(t,e.path);if(!zP(r))return!0;if(e.isDirectory)try{return qJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function cAe(t){let{cwd:e="."}=t,r=[];for(let i of sAe)aAe(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(zP(n)){let i=dAe(n),o=i?null:lAe(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=uAe(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 lAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!zP(r))continue;let n;try{n=qJ(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 uAe(t){try{return q(t),null}catch(e){return e.message}}function dAe(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,sAe,HJ,BJ=y(()=>{"use strict";Ue();V_();xp="ABSENCE_OF_GOVERNANCE",sAe=[{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}];HJ={name:xp,run:cAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function UP(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=pAe.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=fAe[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 mAe(t,e){let r=UP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...mAe(r,n));return e}var fAe,pAe,qP=y(()=>{"use strict";fAe={event:"when",state:"while",optional:"where",unwanted:"if"},pAe=/\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 hAe(t){let{cwd:e="."}=t;return ye(e,Gv,gAe)}function gAe(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 GJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,ZJ,VJ=y(()=>{"use strict";qP();xt();Gv="AC_DRIFT";ZJ={name:Gv,run:hAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return KJ[n]??WJ}var yAe,_Ae,bAe,WJ,vAe,SAe,KJ,wAe,JJ,Va=y(()=>{"use strict";Dn();yAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,_Ae=/^[ \t]*import\s+([\w.]+)/gm,bAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:yAe,importStyle:"relative"},vAe={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:_Ae,importStyle:"dotted"},SAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:bAe,importStyle:"dotted"},KJ={typescript:WJ,kotlin:vAe,python:SAe},wAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JJ=new Set([...Object.values(KJ).flatMap(t=>t?.extensions??[]),...wAe].map(t=>t.toLowerCase()))});import{existsSync as xAe,readFileSync as $Ae,readdirSync as kAe,statSync as EAe}from"node:fs";import{join as XJ,relative as YJ}from"node:path";function AAe(t,e){if(!xAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=kAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XJ(i,s),c;try{c=EAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function TAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function RAe(t){return OAe.test(t)}function IAe(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=>AAe(XJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=$Ae(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Va();QJ="AI_HINTS_FORBIDDEN_PATTERN";OAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;e8={name:QJ,run:IAe}});function PAe(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:r8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var r8,n8,i8=y(()=>{"use strict";Ue();r8="AC_DUPLICATE_WITHIN_FEATURE";n8={name:r8,run:PAe}});import{createRequire as CAe}from"module";import{basename as DAe,dirname as BP,normalize as NAe,relative as jAe,resolve as MAe,sep as a8}from"path";import*as FAe from"fs";function LAe(t){let e=NAe(t);return e.length>1&&e[e.length-1]===a8&&(e=e.substring(0,e.length-1)),e}function c8(t,e){return t.replace(zAe,e)}function qAe(t){return t==="/"||UAe.test(t)}function HP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=MAe(t)),(n||o)&&(t=LAe(t)),t===".")return"";let s=t[t.length-1]!==i;return c8(s?t+i:t,i)}function l8(t,e){return e+t}function HAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:c8(jAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function BAe(t){return t}function GAe(t,e,r){return e+t+r}function ZAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?HAe(t,e):n?l8:BAe}function VAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function WAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function XAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?WAe(t):VAe(t):n&&n.length?JAe:KAe:YAe}function iTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?nTe:r&&r.length?n?QAe:eTe:n?tTe:rTe}function aTe(t){return t.group?sTe:oTe}function uTe(t){return t.group?cTe:lTe}function pTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?fTe:dTe}function u8(t,e,r){if(r.options.useRealPaths)return mTe(e,r);let n=BP(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=BP(n)}return r.symlinks.set(t,e),i>1}function mTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function xTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?hTe:bTe:n?e?gTe:wTe:i?e?_Te:STe:e?yTe:vTe}function ETe(t){return t?kTe:$Te}function RTe(t,e){return new Promise((r,n)=>{p8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function p8(t,e,r){new f8(t,e,r).start()}function ITe(t,e){return new f8(t,e).start()}var o8,zAe,UAe,KAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,oTe,sTe,cTe,lTe,dTe,fTe,hTe,gTe,yTe,_Te,bTe,vTe,STe,wTe,d8,$Te,kTe,ATe,TTe,OTe,f8,s8,m8,h8,g8=y(()=>{o8=CAe(import.meta.url);zAe=/[\\/]/g;UAe=/^[a-z]:[\\/]$/i;KAe=(t,e)=>{e.push(t||".")},JAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},YAe=()=>{};QAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},eTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},tTe=(t,e,r,n)=>{r.files++},rTe=(t,e)=>{e.push(t)},nTe=()=>{};oTe=t=>t,sTe=()=>[""].slice(0,0);cTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},lTe=()=>{};dTe=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()&&u8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},fTe=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()&&u8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};hTe=t=>t.counts,gTe=t=>t.groups,yTe=t=>t.paths,_Te=t=>t.paths.slice(0,t.options.maxFiles),bTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),vTe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),STe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),wTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);d8={withFileTypes:!0},$Te=(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||".",d8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},kTe=(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||".",d8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};ATe=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))}},TTe=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}},OTe=class{aborted=!1;abort(){this.aborted=!0}},f8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=xTe(e,this.isSynchronous),this.root=HP(t,e),this.state={root:qAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new TTe,options:e,queue:new ATe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new OTe,fs:e.fs||FAe},this.joinPath=ZAe(this.root,e),this.pushDirectory=XAe(this.root,e),this.pushFile=iTe(e),this.getArray=aTe(e),this.groupFiles=uTe(e),this.resolveSymlink=pTe(e,this.isSynchronous),this.walkDirectory=ETe(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(_=HP(_,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=DAe(_),x=HP(BP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};s8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return RTe(this.root,this.options)}withCallback(t){p8(this.root,this.options,t)}sync(){return ITe(this.root,this.options)}},m8=null;try{o8.resolve("picomatch"),m8=o8("picomatch")}catch{}h8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:a8,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 s8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new s8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||m8;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((Zft,S8)=>{"use strict";var y8="[^\\\\/]",PTe="(?=.)",_8="[^/]",GP="(?:\\/|$)",b8="(?:^|\\/)",ZP=`\\.{1,2}${GP}`,CTe="(?!\\.)",DTe=`(?!${b8}${ZP})`,NTe=`(?!\\.{0,1}${GP})`,jTe=`(?!${ZP})`,MTe="[^.\\/]",FTe=`${_8}*?`,LTe="/",v8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:PTe,QMARK:_8,END_ANCHOR:GP,DOTS_SLASH:ZP,NO_DOT:CTe,NO_DOTS:DTe,NO_DOT_SLASH:NTe,NO_DOTS_SLASH:jTe,QMARK_NO_DOT:MTe,STAR:FTe,START_ANCHOR:b8,SEP:LTe},zTe={...v8,SLASH_LITERAL:"[\\\\/]",QMARK:y8,STAR:`${y8}*?`,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:"\\"},UTe={__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"};S8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:UTe,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?zTe:v8}}});var kp=v(Ur=>{"use strict";var{REGEX_BACKSLASH:qTe,REGEX_REMOVE_BACKSLASH:HTe,REGEX_SPECIAL_CHARS:BTe,REGEX_SPECIAL_CHARS_GLOBAL:GTe}=$p();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>BTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(GTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(qTe,"/");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(HTe,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 O8=v((Wft,T8)=>{"use strict";var w8=kp(),{CHAR_ASTERISK:VP,CHAR_AT:ZTe,CHAR_BACKWARD_SLASH:Ep,CHAR_COMMA:VTe,CHAR_DOT:WP,CHAR_EXCLAMATION_MARK:KP,CHAR_FORWARD_SLASH:A8,CHAR_LEFT_CURLY_BRACE:JP,CHAR_LEFT_PARENTHESES:YP,CHAR_LEFT_SQUARE_BRACKET:WTe,CHAR_PLUS:KTe,CHAR_QUESTION_MARK:x8,CHAR_RIGHT_CURLY_BRACE:JTe,CHAR_RIGHT_PARENTHESES:$8,CHAR_RIGHT_SQUARE_BRACKET:YTe}=$p(),k8=t=>t===A8||t===Ep,E8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},XTe=(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&&k8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=w8.removeBackslashes(C)),J&&_===!0&&(J=w8.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,k8(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(),ln=kp(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:QTe,REGEX_NON_SPECIAL_CHARS:eOe,REGEX_SPECIAL_CHARS_BACKREF:tOe,REPLACEMENTS:R8}=Ap,rOe=(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=>ln.escapeRegex(i)).join("..")}return r},Kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,I8=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},nOe=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},QP=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(nOe(e))return e.replace(/\\(.)/g,"$1")},iOe=t=>{let e=t.map(QP).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}}}}},oOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,sOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=QP(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},aOe=t=>{let e=0,r=t.trim(),n=XP(r);for(;n;)e++,r=n.body.trim(),n=XP(r);return e},cOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=I8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||iOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=sOe(a);if(c){o=!0,i.push(...c);continue}let l=QP(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,aOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:oOe([...new Set(i)])}:{risky:!0}:{risky:!1}},eC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R8[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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},$fe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=cOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=eC(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,ht=t.replace(tOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=QTe[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=ln.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){$fe(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||ln.hasRegexChars(B))continue;let Oe=ln.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=rOe(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=eOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","}"));E.output=ln.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};eC.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=R8[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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};P8.exports=eC});var j8=v((Jft,N8)=>{"use strict";var lOe=O8(),tC=C8(),D8=kp(),uOe=$p(),dOe=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=dOe(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?D8.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(D8.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)):tC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>lOe(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=tC.fastpaths(t,e)),i.output||(i=tC(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=uOe;N8.exports=Rt});var z8=v((Yft,L8)=>{"use strict";var M8=j8(),fOe=kp();function F8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:fOe.isWindows()}),M8(t,e,r)}Object.assign(F8,M8);L8.exports=F8});import{readdir as pOe,readdirSync as mOe,realpath as hOe,realpathSync as gOe,stat as yOe,statSync as _Oe}from"fs";import{isAbsolute as bOe,posix as Wa,resolve as vOe}from"path";import{fileURLToPath as SOe}from"url";function kOe(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]===".."&&$Oe.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 TOe(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 q8(t){return t.replace(xOe,e=>`${e}/`)}function Z8(t){var e;let r=Jl.default.scan(t,OOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function NOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Jl.default.scan(t);return r.isGlob||r.negated}function Tp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function V8(t){return typeof t=="string"?[t]:t??[]}function rC(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=DOe(o);s=bOe(s.replace(MOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=jOe.exec(s))===null||i===void 0?void 0:i[0],l=Z8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=q8(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 FOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(rC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(rC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(rC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function LOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=FOe(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(B8,""),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=kOe(i.match,f),g=U8(r,d,o),b=o?g:U8(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 h8({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&&TOe(r,d)]}function zOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function UOe(t){let e=Object.assign({},t);for(let r in H8)e[r]===void 0&&Object.assign(e,{[r]:H8[r]});return e.cwd=(e.cwd instanceof URL?SOe(e.cwd):vOe(e.cwd||process.cwd())).replace(B8,"/"),e.ignore=V8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||pOe,readdirSync:e.fs.readdirSync||mOe,realpath:e.fs.realpath||hOe,realpathSync:e.fs.realpathSync||gOe,stat:e.fs.stat||yOe,statSync:e.fs.statSync||_Oe}),e.debug&&Tp("globbing with options:",e),e}function qOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=wOe(t)||typeof t=="string",i=V8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=UOe(n?e:t);return i.length>0?LOe(o,i):[]}function vs(t,e){let[r,n]=qOe(t,e);return r?zOe(r.sync(),n):[]}var Jl,wOe,B8,xOe,G8,$Oe,EOe,AOe,OOe,ROe,IOe,POe,COe,DOe,jOe,MOe,H8,Op=y(()=>{g8();Jl=wt(z8(),1),wOe=Array.isArray,B8=/\\/g,xOe=/^[A-Za-z]:$/,G8=process.platform==="win32",$Oe=/^(\/?\.\.)+$/;EOe=/^[A-Z]:\/$/i,AOe=G8?t=>EOe.test(t):t=>t==="/";OOe={parts:!0};ROe=/(?t.replace(ROe,"\\$&"),COe=t=>t.replace(IOe,"\\$&"),DOe=G8?COe:POe;jOe=/^(\/?\.\.)+/,MOe=/\\(?=[()[\]{}!*+?@|])/g;H8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Rp,readFileSync as HOe,readdirSync as BOe,statSync as W8}from"node:fs";import{join as Ka}from"node:path";function GOe(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}=nC(r);return(s.size>0||a.length>0)&&!Rp(Ka(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&&(ZOe(e,i,s,o),VOe(e,i,s,o)),a.length>0&&WOe(e,i,a,o),o)}function nC(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 ZOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of BOe(o)){let a=Ka(o,s);W8(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 VOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of r){let a=Ka(o,s);Rp(a)&&W8(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 WOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Rp(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=HOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];KOe(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 KOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ip,K8,iC=y(()=>{"use strict";Op();Ue();Va();Ip="ARCHITECTURE_FROM_SPEC";K8={name:Ip,run:GOe}});import{existsSync as JOe,readFileSync as YOe}from"node:fs";import{join as XOe}from"node:path";function eRe(t){let{cwd:e="."}=t,r=XOe(e,"spec/capabilities.yaml");if(!JOe(r))return[];let n;try{let u=YOe(r,"utf8"),d=J8.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";J8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",QOe=8;Y8={name:Wv,run:eRe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function oRe(t){let{cwd:e="."}=t;return ye(e,oC,r=>sRe(r,e))}function sRe(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=nRe(e,o);if(!tRe(s))continue;let a=rRe(s,"utf8");iRe(a)||n.push({detector:oC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var oC,Q8,e5=y(()=>{"use strict";Va();xt();oC="CONVENTION_DRIFT";Q8={name:oC,run:oRe}});import{existsSync as sC,readFileSync as t5}from"node:fs";import{join as Kv}from"node:path";function aRe(t){return JSON.parse(t).total?.lines?.pct??0}function r5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function uRe(t,e){if(!Cv(_t(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=NP.find(d=>sC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=r5(t5(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=n5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function dRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=uRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?NP.find(a=>sC(Kv(e,a)))??MJ(e):n.coverageSummary,o=Kv(e,i);if(!sC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=t5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?cRe(a):n.coverageFormat==="cobertura-xml"?lRe(a):aRe(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,i5,o5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;i5={name:Eo,run:dRe}});import{existsSync as fRe}from"node:fs";import{join as pRe}from"node:path";function hRe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>gRe(r,e))}function gRe(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",mRe=8;s5={name:Yv,run:hRe}});function yRe(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 _Re(t){let e=yRe(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 bRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>_Re(r))}var Xv,c5,l5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";c5={name:Xv,run:bRe}});function vRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>SRe(r,e))}function SRe(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,aC=y(()=>{"use strict";$l();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:vRe}});function wRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return xRe(r)}function xRe(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:u5,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 u5,tS,cC=y(()=>{"use strict";Ue();u5="DEPENDENCY_CYCLE";tS={name:u5,run:wRe}});import{appendFileSync as $Re,existsSync as d5,mkdirSync as kRe,readFileSync as ERe}from"node:fs";import{dirname as ARe,join as TRe}from"node:path";function f5(t){return TRe(t,ORe,RRe)}function p5(t){return lC.add(t),()=>lC.delete(t)}function Ja(t,e){let r=f5(t),n=ARe(r);d5(n)||kRe(n,{recursive:!0}),$Re(r,`${JSON.stringify(e)} +`,"utf8");for(let i of lC)try{i(t,e)}catch{}}function pr(t){let e=f5(t);if(!d5(e))return[];let r=ERe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var ORe,RRe,lC,un=y(()=>{"use strict";ORe=".cladding",RRe="audit.log.jsonl";lC=new Set});import{existsSync as IRe}from"node:fs";import{join as PRe}from"node:path";function CRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:uC,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&&(IRe(PRe(e,i.artifact))||n.push({detector:uC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var uC,m5,h5=y(()=>{"use strict";un();uC="EVIDENCE_MISMATCH";m5={name:uC,run:CRe}});import{existsSync as DRe,readFileSync as NRe}from"node:fs";import{join as jRe}from"node:path";function MRe(t){let e=jRe(t,b5);if(!DRe(e))return null;try{let n=((0,_5.parse)(NRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*y5(t,e){for(let r of t??[])r.startsWith(g5)&&(yield{ref:r,name:r.slice(g5.length),field:e})}function FRe(t){let{cwd:e="."}=t,r=MRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:dC,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=[...y5(s.evidence_refs,"evidence_refs"),...y5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:dC,severity:"warn",path:b5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var _5,dC,g5,b5,v5,S5=y(()=>{"use strict";_5=wt(tr(),1);Ue();dC="FIXTURE_REFERENCE_INVALID",g5="fixture:",b5="conformance/fixtures.yaml";v5={name:dC,run:FRe}});import{existsSync as Yl,readFileSync as fC}from"node:fs";import{join as Ya}from"node:path";function LRe(t){return vs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Pp(t){if(!Yl(t))return null;try{return JSON.parse(fC(t,"utf8"))}catch{return null}}function zRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(fC(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=LRe(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 URe(t,e){for(let r of w5){let n=Ya(t,r.path);if(!Yl(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 qRe(t,e){let r=Pp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of w5){let s=Ya(t,o.path);if(!Yl(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=Ya(t,".claude-plugin","marketplace.json");if(Yl(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 HRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function BRe(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=HRe(fC(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 GRe(t){let{cwd:e="."}=t,r=[];return zRe(e,r),BRe(e,r),URe(e,r),qRe(e,r),r}var Ao,w5,x5,$5=y(()=>{"use strict";Op();Ao="HARNESS_INTEGRITY",w5=[{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"]}];x5={name:Ao,run:GRe}});import{existsSync as ZRe,readFileSync as VRe}from"node:fs";import{join as WRe}from"node:path";function JRe(t){let{cwd:e="."}=t;return ye(e,rS,r=>XRe(r,e))}function YRe(t){let e=WRe(t,"spec/capabilities.yaml");if(!ZRe(e))return!1;try{let r=k5.default.parse(VRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function XRe(t,e){let r=t.features.length;if(r{"use strict";k5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",KRe=8;E5={name:rS,run:JRe}});function QRe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function eIe(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,Xa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=QRe(r.toml,r.ptr),o=eIe(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(` +${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function tIe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function nS(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!=="'"&&tIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Cp=y(()=>{Xa();});var rIe,Qa,pC=y(()=>{rIe=/^(\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(rIe);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();pC();Xa();nIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,iIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,oIe=/^[+-]?0[0-9_]/,sIe=/^[0-9a-f]{2,8}$/i,O5={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function aIe(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 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==="["?P5(t,e,n,i):I5(t,e,n,i);if(r){if(l=dn(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=dn(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=T5(t,e,",",r);let a=aIe(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=dn(t,e+a[1]),s+=+(t[s]===",")),[R5(a[0],t,e,i),s]}var hC=y(()=>{mC();gC();Cp();Xa();});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(!cIe.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{mC();hC();Cp();Xa();cIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function C5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{gC();hC();Cp();Xa();});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 lIe(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 N5,j5=y(()=>{N5=/^[a-z0-9-_]+$/i});var wC={};Nr(wC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>pIe,parse:()=>yC,stringify:()=>SC});var pIe,xC=y(()=>{D5();j5();pC();Xa();pIe={parse:yC,stringify:SC,TomlDate:Qa,TomlError:ge}});import{cpSync as mIe,existsSync as jn,lstatSync as hIe,mkdirSync as gIe,readFileSync as uS,readlinkSync as yIe,readdirSync as _Ie,rmSync as F5,writeFileSync as ec}from"node:fs";import{homedir as L5,platform as z5}from"node:os";import{basename as bIe,dirname as Ss,isAbsolute as vIe,join as he,relative as SIe,resolve as ws}from"node:path";import{fileURLToPath as wIe}from"node:url";import{spawnSync as U5}from"node:child_process";function aS(t){gIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return hIe(t).isSymbolicLink()}catch{return!1}}function kIe(t){try{return ws(Ss(t),yIe(t))}catch{return null}}function q5(t,e){let r=SIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!vIe(r)}function EIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",kC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=kIe(t);if(!r||!e.some(n=>q5(r,n)))return"skipped-different";try{return F5(t,{force:!0}),"removed"}catch{return"failed"}}function AIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of _Ie(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]===EC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>q5(n[0],i))}function TIe(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??""} -${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(` +`)}async function OIe(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(()=>(xC(),wC)),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=TIe(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 RIe(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,ec(r,`${JSON.stringify(i,null,2)} +`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function IIe(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 Ql([o,tc(he(n,"plugin.json"),s)])}function PIe(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 CIe(t){let e=z5()==="win32"?"where":"which";return U5(e,[t],{stdio:"ignore"}).status===0}function DIe(t){if(!t||!CIe("claude"))return"manual-required";let e=U5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:z5()==="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 NIe(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 jIe(){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 MIe(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(` `)?` `:"";ec(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/,`--- +`,"utf8")}function FIe(){return{command:"node",args:[EC]}}function $C(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- +`))return"failed";let i=bIe(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)} -`,"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 +`);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";F5(e,{recursive:!0,force:!0})}return aS(Ss(e)),mIe(t,e,{recursive:!0,dereference:!0}),ec(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,tc(t,`${JSON.stringify(i,null,2)} +`))}catch{return"failed"}}function LIe(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 $Ie)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 zIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(xC(),wC)),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,tc(t,i(s)))}catch{return"failed"}}function UIe(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 H5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function M5(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 TC(t={}){let e=t.home??L5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??B5(),i=t.version??G5(n),o=HIe(e),s=new Set(t.hosts??xIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",kC),l=H5(c),u=[],d=[];aS(r),MIe(r);let f=[tc(he(r,EC),NIe(n))];s.has("gemini")&&f.push(tc(he(r,AC),jIe()));let p=Ql(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?$C(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=FIe(),b=EIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?DIe(t.activate??!0):"unchanged",x={claude_plugin:Ql([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:PIe(e,b),codex_skills:AIe(e,b),codex_mcp:await OIe(e,b),cursor_mcp:RIe(e,b)},w=s.has("codex")?await zIe(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")?Ql([Mp(he(r,".agents","mcp_config.json"),g,a),IIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?Ql([$C(m,he(r,".claude","skills","cladding-init"),a),Mp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?Ql([$C(m,he(r,".cursor","skills","cladding-init"),a),Mp(he(r,".cursor","mcp.json"),g,a),LIe(he(r,".cursor","cli.json")),UIe(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))M5(J,X,u,d);for(let[X,J]of Object.entries(x))M5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${qIe(ae)} +`),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 qIe(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 B5(){let t=wIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function G5(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 fn(t=B5()){let e=G5(t);return e==="unknown"?null:e}function Z5(t=process.cwd()){return H5(he(ws(t),".cladding",kC))}function HIe(t=L5()){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 kC,EC,AC,xIe,$Ie,eu=y(()=>{"use strict";kC="setup-status.json",EC=he(".cladding","host","serve.cjs"),AC=".cladding/host/gemini-doctor-policy.toml",xIe=["claude","codex","gemini","antigravity","cursor"],$Ie=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as V5,readFileSync as W5}from"node:fs";import{join as K5}from"node:path";function J5(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 KIe(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 Y5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function X5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function JIe(t,e){let r=X5(t),n=X5(e);if(!r||!n)return!1;for(let i=0;iWIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(ZIe)?.[1],s=fn();return o!==void 0&&s!==null&&JIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function XIe(t){let e=K5(t,"README.md"),r=K5(t,"docs","dogfood","matrix.md");if(!V5(e)||!V5(r))return[];let n=W5(e,"utf8"),i=W5(r,"utf8"),o=J5(n,BIe),s=J5(i,GIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=Y5(d);if(f===null)continue;let p=s[u]??"not-run",m=KIe(p);m!==null&&f>m&&a.push({detector:OC,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=>Y5(u)!==null)?YIe(i,Date.now()):[];return l.length>0&&a.push({detector:OC,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 QIe(t){let{cwd:e="."}=t;return XIe(e)}var OC,BIe,GIe,ZIe,VIe,WIe,Q5,eY=y(()=>{"use strict";eu();OC="HOST_CLAIM_DRIFT",BIe=//,GIe=//,ZIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,VIe=/^- Generated:\s*(\S+)\s*$/m,WIe=720*60*60*1e3;Q5={name:OC,run:QIe}});function ePe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return tY(r.features.map(i=>i.id),"feature","spec/features/",n),tY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function tY(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:rY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var rY,nY,iY=y(()=>{"use strict";Ue();rY="ID_COLLISION";nY={name:rY,run:ePe}});import{existsSync as Lp,readFileSync as RC,readdirSync as IC,statSync as tPe,writeFileSync as sY}from"node:fs";import{join as To}from"node:path";function oY(t){if(!Lp(t))return 0;try{return IC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function rPe(t){if(!Lp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=IC(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=tPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function nPe(t){let e=To(t,"spec","capabilities.yaml");if(!Lp(e))return 0;try{let r=dS.default.parse(RC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=oY(To(t,"spec","features")),r=oY(To(t,"spec","scenarios")),n=nPe(t),i=rPe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function tu(t,e){let r=To(t,"spec.yaml");if(!Lp(r))return;let n=RC(r,"utf8"),i=iPe(n,e);i!==n&&sY(r,i)}function iPe(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 rc(t="."){let e=To(t,"spec","features");if(!Lp(e))return!1;let r=[];for(let i of IC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(RC(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 sY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,zp=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as aY,readFileSync as cY,readdirSync as oPe}from"node:fs";import{join as PC}from"node:path";function sPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=lY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return CC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...CC(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 lY){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(...CC(e)),o}function CC(t){let e=PC(t,"spec","index.yaml"),r=PC(t,"spec","features");if(!aY(e)||!aY(r))return[];let n=new Map;try{for(let l of cY(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 oPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=cY(PC(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,lY,uY,dY=y(()=>{"use strict";zp();Ue();Up="INVENTORY_DRIFT",lY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];uY={name:Up,run:sPe}});import{existsSync as aPe,readFileSync as cPe}from"node:fs";import{join as lPe}from"node:path";function dPe(t){let{cwd:e="."}=t,r=lPe(e,"src","spec","schema.json"),n=[];if(aPe(r)){let i;try{i=JSON.parse(cPe(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 uPe)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!==fY&&n.push({detector:qp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${fY}'`})}catch{}return n}var qp,uPe,fY,pY,mY=y(()=>{"use strict";Ue();qp="META_INTEGRITY",uPe=["schema","project","features"],fY="0.1";pY={name:qp,run:dPe}});function fPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return hY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),hY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function hY(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:gY,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 gY,yY,_Y=y(()=>{"use strict";Ue();gY="SLUG_CONFLICT";yY={name:gY,run:fPe}});function ru(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as pPe}from"node:fs";import{join as mPe}from"node:path";function hPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>gPe(r,e))}function gPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=mPe(e,i);pPe(o)||r.push(yPe(n.id,i,n.status))}return r}function yPe(t,e,r){return ru(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,DC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:hPe}});function _Pe(t){let{cwd:e="."}=t;return ye(e,NC,bPe)}function bPe(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:NC,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 NC,hS,jC=y(()=>{"use strict";xt();NC="MISSING_TESTS";hS={name:NC,run:_Pe}});import{existsSync as vPe,readFileSync as SPe}from"node:fs";import{join as bY}from"node:path";function vY(t){if(vPe(t))try{return JSON.parse(SPe(t,"utf8"))}catch{return}}function kPe(t){let{cwd:e="."}=t,r=vY(bY(e,wPe)),n=vY(bY(e,xPe));if(!r||!n)return[{detector:MC,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>$Pe&&i.push({detector:MC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var MC,wPe,xPe,$Pe,SY,wY=y(()=>{"use strict";MC="PERFORMANCE_DRIFT",wPe="perf/baseline.json",xPe="perf/current.json",$Pe=10;SY={name:MC,run:kPe}});import{existsSync as EPe}from"node:fs";import{join as APe}from"node:path";function OPe(t){let{cwd:e="."}=t;return ye(e,FC,r=>IPe(r,e))}function RPe(t,e){return(t.modules??[]).some(r=>EPe(APe(e,r)))}function IPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||RPe(s,e)||r.push(s.id);let n=TPe;if(r.length<=n)return[];let i=r.slice(0,xY).join(", "),o=r.length>xY?", \u2026":"";return[{detector:FC,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 FC,TPe,xY,$Y,kY=y(()=>{"use strict";xt();FC="PLANNED_BACKLOG",TPe=5,xY=8;$Y={name:FC,run:OPe}});import{existsSync as PPe,readFileSync as CPe}from"node:fs";import{join as DPe}from"node:path";function MPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>FPe(r,e))}function FPe(t,e){if(t.features.lengthn.includes(i))?[{detector:LC,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 LC,NPe,jPe,EY,AY=y(()=>{"use strict";xt();LC="PROJECT_CONTEXT_DRIFT",NPe=8,jPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];EY={name:LC,run:MPe}});function TY(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:gS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function LPe(t){let{cwd:e="."}=t;return ye(e,gS,zPe)}function zPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...TY(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(...TY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,zC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:LPe}});function Hp(t=""){return new RegExp(UPe,t)}var UPe,UC=y(()=>{"use strict";UPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as qPe,readdirSync as HPe,readFileSync as BPe,statSync as GPe,writeFileSync as ZPe}from"node:fs";import{dirname as VPe,join as Bp,normalize as WPe,relative as KPe}from"node:path";function eCe(t){let e=[];for(let r of t.matchAll(QPe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Hp("g"))??[])e.push(n);return[...new Set(e)].sort()}function tCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function OY(t){return t.split("\\").join("/")}function rCe(t){return JPe.some(e=>t===e||t.startsWith(`${e}/`))}function nCe(t){let e=Bp(t,"docs");if(!qPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=HPe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Bp(i,s),c;try{c=GPe(a)}catch{continue}let l=OY(KPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function iCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=WPe(Bp(VPe(t),e));return OY(r)}function Gp(t="."){let e=[];for(let r of nCe(t)){let n;try{n=BPe(Bp(t,r),"utf8")}catch{continue}let i=tCe(n),o=eCe(i);if(rCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(YPe)?[]:i.match(Hp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(XPe)){let d=iCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function RY(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 ZPe(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: +`}function Vx(t){return`${JSON.stringify(t,null,2)} +`}function Vte(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${Hte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(Bte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(Bte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${Hte(s)}.md`,`${a.join(` +`)}`)}return o}function Bte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as E4e}from"node:fs";import{dirname as A4e,join as Zj}from"node:path";import{fileURLToPath as T4e}from"node:url";var Vj=A4e(T4e(import.meta.url));function Wte(t){for(let e of[Zj(Vj,"viewer",t),Zj(Vj,"..","graph","viewer",t),Zj(Vj,"..","..","dist","viewer",t)])try{return E4e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Kte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -922,21 +922,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}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 +`}cC();qC();DC();jC();zC();aC();WC();KC();XC();eD();oh();UC();Ue();var O4e=[hS,AS,mS,ES,yS,vS,tS,$S,xS,eS];function R4e(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 Kx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of O4e){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 R4e(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}Wj();Ue();Pi();var P4e=new Set(["mermaid","dot","json","obsidian","html"]);function Yte(t={}){try{let e=t.format??"mermaid";if(!P4e.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=Hx(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=qx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vte(i);for(let[c,l]of a){let u=I4e(s,c);Kj(Yj(u),{recursive:!0}),Jj(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=Wx(i,Kx(i,"."));Kj(Yj(t.out),{recursive:!0}),Jj(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"?Zte(i):r==="json"?Vx(i):Gte(i);t.out?(Kj(Yj(t.out),{recursive:!0}),Jj(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 Xte(){try{let t=kc(q(),".");process.stdout.write(Jte(Jx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as C4e}from"node:http";import{existsSync as D4e,watch as N4e}from"node:fs";import{join as j4e}from"node:path";Ue();Pi();function M4e(t={}){let e=t.cwd??".",r=new Set,n=()=>kc(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 +`)}catch{r.delete(u)}},o=C4e((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=Vx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Kx(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 +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Wx(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=j4e(e,u);if(D4e(d))try{let f=N4e(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 Qte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await M4e({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 F4e=["stage_1.1","stage_2.1","stage_2.3"];function L4e(t){return(t.features??[]).filter(e=>e.status==="done")}function z4e(t,e){let r=L4e(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 ere(t,e){let r=[];for(let n of F4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=z4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}CS();import tre from"node:process";function U4e(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 Yx(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=U4e(n,t);i.pass||r.push(i)}return r}un();var Xj="stage_4.1";function Qj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Xj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Yx(r);if(n.length===0)return{stage:Xj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Xj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var q4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tre.argv[1]}`;if(q4e){let t=Qj();console.log(JSON.stringify(t)),tre.exit(t.exitCode)}kl();import{randomBytes as H4e}from"node:crypto";import{unlinkSync as B4e}from"node:fs";import{tmpdir as G4e}from"node:os";import{join as Z4e,resolve as eM}from"node:path";import V4e from"node:process";var Gr=null;function rre(t){Gr={cwd:eM(t),run:null,jsonFile:null}}function tM(){return Gr!==null}function rM(t,e){if(!Gr||Gr.cwd!==eM(t))return null;if(Gr.run)return Gr.run;let r=Z4e(G4e(),`clad-shared-vitest-${V4e.pid}-${H4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function nre(t){return!Gr||Gr.cwd!==eM(t)?null:Gr.run}function nM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ire(){let t=Gr?.jsonFile;if(Gr=null,t)try{B4e(t)}catch{}}zr();import ore from"node:process";var Xx="stage_1.4";function iM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Xx,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:Xx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Xx,pass:!0,exitCode:0}:{stage:Xx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var W4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ore.argv[1]}`;if(W4e){let t=iM();console.log(JSON.stringify(t)),ore.exit(t.exitCode)}zr();import sre from"node:process";sh();Nn();var Qx="stage_2.2";function oM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Qx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Qx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=nre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(Qx,r,s,n);return a||Xt(Qx,s)}var Y4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${sre.argv[1]}`;if(Y4e){let t=oM();console.log(JSON.stringify(t)),sre.exit(t.exitCode)}Xp();aD();sM();zr();Dn();Nn();import cre from"node:process";var r0="stage_3.2";function aM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:r0,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:r0,pass:!1,exitCode:2,stderr:"perf 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 yHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(yHe){let t=aM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as _He}from"node:fs";import{resolve as ure}from"node:path";import dre from"node:process";var fi="stage_2.4",cM=5e3,bHe=3e4;function lM(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 SHe(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=ure(e,r.path);if(!_He(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??cM,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 lre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},vHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function SHe(t,e,r){let n=Math.min(e.length*cM,bHe),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(wHe(t,s,r))}return xHe(o)}function wHe(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("/")?ure(t,a):a,u=cM,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 xHe(t){let e="skip";for(let o of t)lre[o.disposition]>lre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${vHe[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 $He=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dre.argv[1]}`;if($He){let t=lM();console.log(JSON.stringify(t)),dre.exit(t.exitCode)}zr();Dn();Nn();import fre from"node:process";var n0="stage_3.1";function uM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,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:n0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var kHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(kHe){let t=uM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}BC();dM();fM();zr();e0();import{randomBytes as PHe}from"node:crypto";import{unlinkSync as CHe}from"node:fs";import{tmpdir as DHe}from"node:os";import{join as NHe}from"node:path";import mM from"node:process";sh();Nn();Ue();import{readFileSync as THe}from"node:fs";import{resolve as hre}from"node:path";function OHe(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=hre(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 RHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function IHe(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=RHe(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(hre(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 pM(t,e){try{let r=OHe(THe(t,"utf8"));return r?IHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function gre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function yre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function _re(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 jHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!gre(n,i))return null;let o=n,s=i,a=rM(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(nM(u)==="fallback")return null;if(r){let d=pM(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 MHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!yre(n,i))return null;let o=n,s=i,a=rM(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(nM(c)==="fallback")return null;if(r&&_re(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 hM(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=gre(n,i),a=yre(n,i),c=r&&s;if(tM()&&s){let d=jHe(t,e,c);if(d)return d}if(tM()&&a){let d=MHe(t,e);if(d)return d}let l,u=i;c&&(l=NHe(DHe(),`clad-vitest-${mM.pid}-${PHe(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=Fu("unit",Xt(Zr,d),d);if(r&&p.pass&&_re(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=pM(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{CHe(l)}catch{}}}var FHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mM.argv[1]}`;if(FHe){let t=hM();console.log(JSON.stringify(t)),mM.exit(t.exitCode)}zr();Dn();Nn();import bre from"node:process";var s0="stage_3.3";function gM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:s0,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:s0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(s0,i,s,o);return a||Xt(s0,s)}var LHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(LHe){let t=gM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}ZC();Gf();wa();_M();zp();_S();var Ere=wt(tr(),1);import{existsSync as bM,readFileSync as JHe,readdirSync as kre,statSync as YHe,writeFileSync as XHe}from"node:fs";import{basename as dh,join as fh,relative as $re}from"node:path";var QHe=["self-dogfood:","fixture:","derived:"],Are=/\.(test|spec)\.[jt]sx?$/;function Tre(t,e=t,r=[]){let n;try{n=kre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{YHe(o).isDirectory()?Tre(t,o,r):Are.test(i)&&r.push(o)}catch{continue}}return r}function Ore(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!bM(e)||!bM(r))return{repaired:n,suggested:i};let o=Tre(r),s=new Map;for(let a of o){let c=$re(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of kre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=JHe(c,"utf8"),u=(0,Ere.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(bM(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=>$re(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Are,"");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??"."} -`),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)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&XHe(c,l,"utf8")}return{repaired:n,suggested:i}}$l();import{existsSync as e6e,readFileSync as t6e}from"node:fs";import{join as r6e}from"node:path";function n6e(t,e){let r=r6e(t,e);if(!e6e(r))return[];let n=[];for(let i of t6e(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 Rre(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=>n6e(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 Ire(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();un();Pi();un();$l();var vM=["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"],i6e=[...vM,"att"];function o6e(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 Yx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function s6e(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 u0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...vM.map(o=>o6e(i,o,e)),s6e(i,r,e)]}));return{columns:i6e,rows:n}}function Pre(t,e=".",r={}){let n=r.internal??!1,i=u0(t,e),o=[...vM.map(c=>n?c.replace("stage_",""):a6e(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 a6e(t){return Ra(t).slice(0,3)}async function FYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Zde(),Gde)),Promise.resolve().then(()=>(Yde(),Jde)),Promise.resolve().then(()=>(cm(),aQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nte(s,a,c),initialize:Nj,prepareClarify:(s,{cwd:a})=>jte(a,s),clarify:Lj,resolveReview:(s,{cwd:a})=>Ite(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 LYe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Nj({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: `);for(let[o,s]of n.clarifyingQuestions.entries())H.stdout.write(` ${o+1}. ${s} @@ -947,36 +947,36 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&UHe(c,l,"u `),H.stdout.write(` e.g. clad init payment SaaS for B2B `),H.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));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} +`));H.exit(0)}async function zYe(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(()=>(wfe(),Sfe)),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=>gR(l,s)),c=`${jG(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 UYe(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("."),RY(".");let n=cu(".");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=Ore(".");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=l0(".");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 qYe(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 HYe(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(` +`),H.exit(0)}async function BYe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await TC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function GYe(){L("note","update","reconciling the current project after the engine upgrade");let t=await P7(".",{wireHosts:async()=>(await TC({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)} -`),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)} +`),MA({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 ZYe={"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 MA(t){let e=t.tier??"all",r=t.silent===!0,n=ZYe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",iM],["stage_1.5",sc],["stage_1.6",rm],["stage_2.1",()=>hM({...i,strict:t.strict})],["stage_2.2",()=>oM(i)],["stage_2.3",HC],["stage_2.4",lM],["stage_3.1",uM],["stage_3.2",aM],["stage_3.3",gM],["stage_4.1",Qj],["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("."),rre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=yX(p);mr(h)&&(c=!0,a=Math.max(a,_X(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)&&eXe(p))}}finally{rb(),ire()}if(t.strict)try{let d=q();for(let f of ere(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{sZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:iZ(OS)})&&(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:RS(u),stopFingerprint:bX(u)}),{worst:a,anyFailed:c,stages:u}}function VYe(t){try{let e=q(),r=yl(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 WYe(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 KYe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=TS(e,o=>{try{return xfe(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 JYe(t={}){try{if(t.sessions){zte(t);return}if(t.trend!==void 0&&t.trend!==!1){Ute(t);return}let e=q(),n=tG(e,o=>{try{return xfe(o,"utf8")}catch{return null}},"."),i=nG(".",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(` `)} -`),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}') -`);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. +`),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 YYe(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=MA({...t,focusModules:e});if(!t.json){let n=e7(".");n&&H.stdout.write(`\u2139 ${n} +`)}H.exitCode=r.worst}function XYe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=ZX(".",t,{checkStages:MA,onIndex:rc,gitOpInProgress:FO,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=NY(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}] +`),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=Rre(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(`${Ire(i)} +`),H.exit(0)}function eXe(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=I4(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(` -`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${A4(l,160)} +`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${I4(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) `),t.hint&&H.stdout.write(` fix: run \`${t.hint}\` `);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)} +`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))H.stdout.write(` ${I4(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)} -`),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}; +`)}}function I4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function tXe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(u0(e,"."),null,2)} +`),H.exitCode=0;return}H.stdout.write(`${Pre(e,".",{internal:t.internal})} +`),H.exit(0)}function rXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function nXe(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=u0(i,e),s={gitHead:xa(e),version:fn(),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=KG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{MYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${rXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function iXe(t){let e=rT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function oXe(){let t=new G4;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(LYe),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(zYe),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(UYe),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(BYe),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(GYe),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(YYe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(qYe),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(XYe),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(HYe),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(tXe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(VYe),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)=>WYe(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=>A7(r,{checkStages:MA})),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=>KYe(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=>JYe(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=>Yte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xte()),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=>{Qte(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=>NG(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=>gX(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=>nXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(iXe),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(v7),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(FYe),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){qX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}CX(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(Dte),t}var sXe=!!globalThis.__CLADDING_BUNDLED,aXe=sXe||import.meta.url===`file://${H.argv[1]}`;aXe&&oXe().parse();export{ZYe as TIER_STAGES,oXe as createProgram,nXe as runBundleCommand,YYe as runCheckCommand,MA as runCheckStages,qYe as runCheckpointCommand,VYe as runContextCommand,XYe as runDoneCommand,WYe as runImpactCommand,KYe as runInferDepsCommand,LYe as runInitCommand,JYe as runMeasureCommand,QYe as runOracleCommand,HYe as runRollbackCommand,iXe as runRouteCommand,zYe as runRunCommand,FYe as runServeCommand,BYe as runSetupCommand,tXe as runStatusCommand,UYe as runSyncCommand,GYe as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index 45b1ce8a..1765e99d 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 + test_files: 255 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index b5c5abbb..5cb84a97 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -26,12 +26,12 @@ attested_modules: CHANGELOG.md: 78288e943090a029 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: 63e3e36ab7fcc2bd + README.ja.md: 9b92d8e95638d2aa + README.ko.html: 49e211ff1332a0fd + README.ko.md: 8866dfcceffc6c7b + README.md: 8bb065e43d439752 + README.zh.md: 2d7b5f006f7ff930 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -47,7 +47,7 @@ attested_modules: docs/ab-evaluation/case-existing-adoption.md: 240a7c641da50a42 docs/ab-evaluation/case-graph-efficiency.md: 83d3956d14a1517d docs/ab-evaluation/case-iterative-vs-fixed-vapt.md: 1d242b8b6071f343 - docs/ab-evaluation/case-payment-saas.md: a316271b319816f6 + docs/ab-evaluation/case-payment-saas.md: e29406c4f5d179b2 docs/ab-evaluation/case-working-set-landmine.md: b4f44dc463e99722 docs/ab-evaluation/summary.md: 59e527a531f13209 docs/b1-adoption-protocol.md: a041d8ad5ba1447f @@ -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: 7e4f358630fa44f2 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -186,13 +186,14 @@ attested_modules: src/cli/scan/roots.ts: 7475eed8c9836531 src/cli/scan/scenarios.ts: 6c2a4ce3b469a668 src/cli/scan/stats.ts: 00c737b7b7acad97 - src/cli/scan/thresholds.ts: ec0047b894a6aa6a + src/cli/scan/thresholds.ts: 1b4ef8c865ca1ae1 src/cli/scan/types.ts: ea0170aa88c1c14a src/cli/scan/walker.ts: 33e4448e365e47c6 src/cli/update.ts: b0151396c9a0f6ca src/cli/verdict.ts: 85a4ef27292b9169 src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: c144e5cc253822b3 + src/core/language-evidence.ts: 0e1a959a10f7bb1c src/core/postmortem.ts: 73be29d5e8a16fd4 src/core/telemetry-summary.ts: 6782bfaa6c3ecfa6 src/drive: a4d0f0eb87fed960 @@ -308,7 +309,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: 4da504acb67aaa86 src/stages/detectors/unmapped-artifact.ts: b29f7e277d8187ae src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 @@ -342,7 +343,7 @@ attested_modules: src/ui: a4d0f0eb87fed960 src/ui/panel.ts: 8b78cb14dafb28fb src/ui/pulse.ts: ee4255f5c6e49f51 - src/ui/softShell.ts: f21a30930c164afd + src/ui/softShell.ts: a733d024692689a2 src/verdict/gate-progress.ts: 41b677e10596ea42 src/verdict/verdict.ts: 2dcfb0e7408bd28d tests/adapters/anthropic.test.ts: fa2fc7faf032a782 @@ -433,7 +434,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: 878436ffd2f94c97 + tests/stages/tech-stack-mismatch.test.ts: 57c435b76972c055 tests/stages/toolchain.test.ts: 200184f572abcf88 tests/stages/toolchain/gate-config.test.ts: aef5813a6591b153 tests/stages/type.test.ts: b57cf7455cae3b32 @@ -640,6 +641,7 @@ attested_features: F-9b643e: ok F-9d168287: ok F-9d8ece66: ok + F-9e1279d4: ok F-a04cd9: ok F-a4085adf: ok F-a4b512: ok diff --git a/spec/features/language-evidence-core-9e1279d4.yaml b/spec/features/language-evidence-core-9e1279d4.yaml new file mode 100644 index 00000000..a60a6073 --- /dev/null +++ b/spec/features/language-evidence-core-9e1279d4.yaml @@ -0,0 +1,70 @@ +id: F-9e1279d4 +slug: language-evidence-core +title: "Language evidence core and evidence-based TECH_STACK_MISMATCH" +status: done +modules: + - src/core/language-evidence.ts + - src/stages/detectors/tech-stack-mismatch.ts + - src/cli/scan/thresholds.ts + - src/ui/softShell.ts +acceptance_criteria: + - id: AC-1c7a90b2 + ears: ubiquitous + action: "resolve the extension-to-language vocabulary, a bounded source walk, and the observed language distribution from one foundation module consumed by both the scan layer and the stage layer" + response: "the onboarding scan and the drift detectors read the same vocabulary, ending the class of bugs where one layer writes a label another layer cannot recognize; the walk skips vendored and generated directories and is capped, so a detector invoking it on every gate run stays bounded" + text: "The system shall expose the extension-to-language vocabulary and the observed source-language distribution from a single foundation module under src/core/ that both the scan layer and the stage layer import." + notes: | + ## Why + Three divergent language tables (scan EXT_TO_LANGUAGE 15, toolchain CHAIN 12, + unmapped EXT_BY_LANGUAGE 6) meant clad init could seed a label the detector + layer then rejected under --strict — measured: init seeded cpp/rust and the + gate blocked both with zero user error. Architecture forbids stages -> cli + imports, so the shared home must be the foundation tier. + test_refs: ["tests/core/language-evidence.test.ts"] + - id: AC-3f8e6d15 + ears: unwanted + condition: "if the declared spec.project.language is outside the vocabulary, or fewer than 5 classified source files exist in the tree" + action: "emit no TECH_STACK_MISMATCH finding at all" + response: "ignorance is never treated as drift: unknown languages (zig, haskell, nim) and evidence-thin trees produce silence instead of a false alarm, and a coverage-ratio rule is deliberately absent because its denominator list flipped failure directions in red-team testing" + text: "If the declared language is unknown to the vocabulary or fewer than 5 classified source files exist, the TECH_STACK_MISMATCH detector shall emit nothing." + notes: | + ## Why + The prior manifest-chain comparison blocked 12 of 19 realistic normal repo + shapes (63%) under --strict. A coverage-ratio guard (D7) was tried and + refuted out-of-sample: whether an unknown extension sat in the denominator + list flipped the failure between false-warn and missed-drift. The + evidence-count rule replaces it and removes that list entirely. + test_refs: ["tests/stages/tech-stack-mismatch.test.ts"] + - id: AC-5b2d47c9 + ears: event + condition: "when the declared language is in the vocabulary, at least 5 classified source files exist, and the declared language is absent from the observed language set" + action: "emit one warn finding naming the declared language and the observed set with counts" + response: "an active contradiction (ported to TypeScript while the spec still says python) is still surfaced and still blocks under --strict, and the message shows the evidence so the developer sees why" + text: "When the declared language is absent from the observed source set with at least 5 classified files, the detector shall emit one warn finding naming the declared language and the observed distribution." + test_refs: ["tests/stages/tech-stack-mismatch.test.ts"] + - id: AC-8d94a1e6 + ears: event + condition: "when the declared language is observed but accounts for less than 10% of classified source files" + action: "emit one info finding naming the share" + response: "a small-but-essential core (a thin C++ SDK under a Kotlin wrapper) is disclosed without ever failing a gate, since residue and thin-core are not mechanically separable" + text: "When the declared language is observed at under 10% of classified sources, the detector shall emit one info finding and never a gate-failing severity." + notes: | + ## Why + Boundary attack proved a normal thin-native SDK (4.8%) sits BELOW a real + ported-residue case (8.3%) — no threshold separates them, so the minority + band discloses instead of blocking. Corpus-supported ranges: evidence + floor K in [3,10] (5 chosen), minority t in [9,50]% (10 chosen; higher t + only adds info noise on normal polyglots). + test_refs: ["tests/stages/tech-stack-mismatch.test.ts"] + - id: AC-e07c3241 + ears: unwanted + condition: "if the project is a normal polyglot whose declared language is a majority or plural presence (an Android app with Kotlin plus NDK C++, a React Native app, a JVM service with Kotlin tests)" + action: "emit nothing" + response: "the manifest chain is no longer consulted for identity, so a build-host label (gradle says java) can no longer contradict a truthful product language, and detectToolchain keeps serving gate-command selection unchanged" + text: "If the declared language is present at or above the minority threshold among observed sources, the detector shall emit nothing, regardless of what the build-manifest chain resolves." + test_refs: ["tests/stages/tech-stack-mismatch.test.ts"] +design_impact: + classification: none + rationale: "Moves a vocabulary map to the foundation tier and re-anchors one detector's evidence source; no architecture layer, capability, or gate-severity policy changes. detectToolchain and gate-command selection are untouched." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 8313f253..b67a7afc 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -200,6 +200,7 @@ features: F-9b643e: {slug: scan-conventions, status: done, modules: 5} F-9d168287: {slug: ears-complex-pattern, status: done, modules: 6} F-9d8ece66: {slug: persona-map-non-exclusivity, status: done, modules: 2} + F-9e1279d4: {slug: language-evidence-core, status: done, modules: 4} F-a04cd9: {slug: ac-hash-ids, status: done, modules: 3} F-a4085adf: {slug: spec-driven-agents-md, status: done, modules: 1} F-a4b512: {slug: dependency-cycle-detector, status: done, modules: 2} diff --git a/src/cli/scan/thresholds.ts b/src/cli/scan/thresholds.ts index 4da598fc..fe042dbf 100644 --- a/src/cli/scan/thresholds.ts +++ b/src/cli/scan/thresholds.ts @@ -105,21 +105,14 @@ export const ENTRYPOINT_NAMES: ReadonlySet = new Set([ 'Program', 'Main', 'App', ]); -/** Maps a file extension to a normalised language label. */ -export const EXT_TO_LANGUAGE: Readonly> = { - '.ts': 'typescript', '.tsx': 'typescript', - '.js': 'javascript', '.jsx': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript', - '.py': 'python', '.pyi': 'python', - '.go': 'go', - '.rs': 'rust', - '.java': 'java', - '.kt': 'kotlin', '.kts': 'kotlin', - '.cs': 'csharp', - '.rb': 'ruby', - '.php': 'php', - '.swift': 'swift', - '.ex': 'elixir', '.exs': 'elixir', - '.scala': 'scala', - '.dart': 'dart', - '.cpp': 'cpp', '.cc': 'cpp', '.cxx': 'cpp', '.hpp': 'cpp', '.h': 'cpp', -}; +/** + * Maps a file extension to a normalised language label. + * + * Owned by `core/language-evidence.ts` since F-9e1279d4 and re-exported + * here so the scan layer's import surface is unchanged. The map moved to + * the foundation tier because the drift detectors need the same + * vocabulary and the architecture forbids `stages → cli`; when scan and + * the detectors read different tables, `clad init` seeds labels the gate + * then rejects. + */ +export {EXT_TO_LANGUAGE} from '../../core/language-evidence.js'; diff --git a/src/core/language-evidence.ts b/src/core/language-evidence.ts new file mode 100644 index 00000000..607c329e --- /dev/null +++ b/src/core/language-evidence.ts @@ -0,0 +1,168 @@ +// Cladding · core · source-language vocabulary + observed distribution +// +// Three divergent language tables used to live in three layers (the scan +// layer's extension map, the toolchain chain, the unmapped-artifact +// extension-by-language map). `clad init` could therefore seed a label — +// `cpp`, `rust` — that the detector layer then refused under `--strict`, +// with zero user error. The fix is a single vocabulary, owned by the +// foundation tier so BOTH the scan layer (cli) and the drift detectors +// (stages) can import it: the architecture forbids `stages → cli`, so +// there is no other legal shared home. +// +// The second export answers the question a detector actually has — +// "what language IS this tree?" — from the files on disk rather than +// from a build manifest. A build manifest names the build host (gradle +// says java), which is the right answer for "what command do we run" +// and the wrong answer for project identity. +// +// Deterministic + synchronous by contract (Iron Law): filesystem reads +// only, no LLM, never throws. An unreadable directory is skipped, not +// raised, so a permission-denied subtree can never break a gate run. +// +// @see F-9e1279d4 — language evidence core. + +import {readdirSync, type Dirent} from 'node:fs'; +import {extname, join} from 'node:path'; + +/** + * Maps a file extension to a normalised language label. The single + * vocabulary for the whole toolchain — the scan layer re-exports this + * from `cli/scan/thresholds.ts` so existing scan imports are unchanged. + */ +export const EXT_TO_LANGUAGE: Readonly> = { + '.ts': 'typescript', '.tsx': 'typescript', + '.js': 'javascript', '.jsx': 'javascript', '.mjs': 'javascript', '.cjs': 'javascript', + '.py': 'python', '.pyi': 'python', + '.go': 'go', + '.rs': 'rust', + '.java': 'java', + '.kt': 'kotlin', '.kts': 'kotlin', + '.cs': 'csharp', + '.rb': 'ruby', + '.php': 'php', + '.swift': 'swift', + '.ex': 'elixir', '.exs': 'elixir', + '.scala': 'scala', + '.dart': 'dart', + '.cpp': 'cpp', '.cc': 'cpp', '.cxx': 'cpp', '.hpp': 'cpp', '.h': 'cpp', +}; + +/** + * Every language label {@link EXT_TO_LANGUAGE} can produce. A declared + * `spec.project.language` outside this set is unknown to cladding, not + * wrong — callers must treat absence here as "cannot judge", never as drift. + */ +export const LANGUAGE_VOCABULARY: ReadonlySet = new Set(Object.values(EXT_TO_LANGUAGE)); + +/** + * Directories the walk never enters: vendored dependencies, build + * output, coverage reports, and cladding's own runtime state. Any + * dot-directory is skipped too (see {@link classifySources}), so `.git` + * and `.cladding` are listed only for readability. + */ +const SKIP_DIRS: ReadonlySet = new Set([ + 'node_modules', '.git', 'dist', 'build', 'out', + 'coverage', 'target', 'vendor', '.cladding', +]); + +/** + * Hard cap on files visited by one {@link classifySources} walk. A drift + * detector calls this on EVERY gate run, so the walk must be bounded + * rather than proportional to repository size: at the cap the walk stops + * and the counts collected so far are returned. 20 000 files is roughly + * an order of magnitude above cladding's own source tree and still costs + * only a few hundred milliseconds of `readdirSync`, so a monorepo slows + * the gate by a bounded amount instead of an unbounded one. The + * distribution is a ratio, and a 20 000-file sample settles a ratio. + * + * Below the cap the result is fully determined by the tree contents; a + * tree that exceeds the cap is sampled in directory-read order, so its + * ratio is an estimate rather than a census. Consumers therefore compare + * the distribution against wide bands, never against exact counts. + */ +export const MAX_FILES = 20_000; + +/** The observed source-language distribution of one project tree. */ +export interface SourceEvidence { + /** Files counted per language label; languages with zero files are absent. */ + readonly counts: Readonly>; + /** Total files whose extension was in the vocabulary. */ + readonly classified: number; + /** The language labels observed, sorted alphabetically. */ + readonly set: readonly string[]; + /** Most-seen language (alphabetical tie-break), or null when nothing was classified. */ + readonly dominant: string | null; + /** + * Fraction of classified files written in `language`, in [0, 1]. + * Zero for an unobserved language and for an empty tree. + */ + share(language: string): number; +} + +/** Tuning knobs for {@link classifySources}. Present for testability. */ +export interface ClassifyOptions { + /** Override for {@link MAX_FILES}. Values below 1 are ignored. */ + readonly maxFiles?: number; +} + +/** + * Walks `cwd` and counts source files per language. + * + * The walk is synchronous, iterative (no recursion depth limit), and + * bounded by {@link MAX_FILES}. Symlinked directories are not followed — + * `Dirent.isDirectory()` is false for a symlink — so a cyclic link + * cannot hang the walk. Unreadable directories are skipped silently. + * + * @param cwd - Project root to classify. + * @param opts - Optional {@link ClassifyOptions}. + * @returns The observed {@link SourceEvidence}; an empty tree yields + * `classified: 0`, `dominant: null`, and `share() === 0`. + */ +export function classifySources(cwd: string, opts: ClassifyOptions = {}): SourceEvidence { + const cap = opts.maxFiles !== undefined && opts.maxFiles >= 1 ? opts.maxFiles : MAX_FILES; + const counts: Record = {}; + let classified = 0; + let visited = 0; + + const stack: string[] = [cwd]; + while (stack.length > 0 && visited < cap) { + const dir = stack.pop()!; + let entries: Dirent[]; + try { + entries = readdirSync(dir, {withFileTypes: true}); + } catch { + continue; // unreadable subtree — skipped, never raised + } + for (const entry of entries) { + if (entry.isDirectory()) { + if (entry.name.startsWith('.') || SKIP_DIRS.has(entry.name)) continue; + stack.push(join(dir, entry.name)); + continue; + } + if (!entry.isFile()) continue; + if (visited >= cap) break; + visited += 1; + const language = EXT_TO_LANGUAGE[extname(entry.name).toLowerCase()]; + if (language === undefined) continue; + counts[language] = (counts[language] ?? 0) + 1; + classified += 1; + } + } + + const set = Object.keys(counts).sort(); + let dominant: string | null = null; + for (const language of set) { + if (dominant === null || counts[language] > counts[dominant]) dominant = language; + } + + return { + counts, + classified, + set, + dominant, + share(language: string): number { + if (classified === 0) return 0; + return (counts[language] ?? 0) / classified; + }, + }; +} diff --git a/src/stages/detectors/tech-stack-mismatch.ts b/src/stages/detectors/tech-stack-mismatch.ts index 8cb7b7cb..699914c7 100644 --- a/src/stages/detectors/tech-stack-mismatch.ts +++ b/src/stages/detectors/tech-stack-mismatch.ts @@ -1,44 +1,125 @@ // Cladding · drift detector · TECH_STACK_MISMATCH // -// Detector #4 from the catalog (axis: spec_vs_code, severity: warn). -// Compares `spec.project.language` against the language `detectToolchain` -// 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. +// Detector #4 from the catalog (axis: spec_vs_code). Answers ONE question: +// does `spec.project.language` contradict the source files on disk? +// +// EVIDENCE MODEL — the files, not the manifest. +// The declared language is compared against the observed distribution of +// source files (`core/language-evidence.ts`), under two guards: +// +// 1. declared language outside the vocabulary → silence. Cladding does +// not know zig or haskell; ignorance is not drift. +// 2. fewer than EVIDENCE_FLOOR classified files → silence. A tree with +// three files cannot support an assertion about what it is. +// +// Then: declared absent from the observed set → one `warn` (an active +// contradiction — ported to TypeScript, spec still says python — which +// still blocks under `--strict`, with the counts shown so the developer +// can see why). Declared present but under MINORITY_SHARE → one `info`, +// never a blocking severity. Anything else → silence. +// +// WHY THERE IS DELIBERATELY NO COVERAGE-RATIO RULE. +// An earlier design guarded on "what fraction of source files did we +// classify at all". Red-team testing refuted it out-of-sample: the rule's +// behaviour hinged entirely on whether an unrecognised extension sat in +// the denominator list. In-list, an unclassifiable tree looked +// well-covered and REAL drift went unreported; out-of-list, an ordinary +// project using one unlisted extension tripped a FALSE warn. The failure +// direction flipped on a list edit, which makes the rule unownable. The +// evidence-count floor replaces it and deletes the list entirely. +// +// WHY THE MANIFEST CHAIN IS NOT CONSULTED HERE. +// `detectToolchain` resolves the BUILD HOST (a gradle wrapper resolves +// java, whatever the product is written in). That is exactly the right +// question for "which commands do we run" — where it keeps serving, and +// which this change does not touch — and exactly the wrong question for +// "what IS this project". Using it for identity let a build-host label +// contradict a truthful product language: the manifest comparison +// blocked 12 of 19 realistic normal repo shapes (63%) under `--strict`. +// +// WHY THE MINORITY BAND DISCLOSES INSTEAD OF BLOCKING. +// A boundary attack found a legitimate thin native SDK at 4.8% sitting +// BELOW a genuine ported-residue case at 8.3%: residue and thin-core are +// not mechanically separable, so the band says so out loud and moves on. +// +// @see F-9e1279d4 — language evidence core. -import {detectToolchain} from '../toolchain/detect.js'; +import {classifySources, LANGUAGE_VOCABULARY} from '../../core/language-evidence.js'; import type {Spec} from '../../spec/types.js'; import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; import {withSpec} from './with-spec.js'; const NAME = 'TECH_STACK_MISMATCH'; +/** + * Minimum classified source files before the detector will assert + * anything. Corpus-supported range [3, 10]; 5 is the chosen point — + * low enough to catch a small ported repo, high enough that a scaffold + * or a docs-only checkout stays silent. + */ +const EVIDENCE_FLOOR = 5; + +/** + * Share below which a declared-but-present language is merely disclosed. + * Corpus-supported range [9%, 50%]; 10% is the chosen point — a higher + * threshold only adds `info` noise on ordinary polyglot repositories. + */ +const MINORITY_SHARE = 0.10; + function runTechStackMismatch(opts: CommandStageOptions): readonly DriftFinding[] { const {cwd = '.'} = opts; return withSpec(cwd, NAME, (spec) => detect(spec, cwd)); } +/** + * Renders the observed distribution most-seen first, e.g. + * `{typescript ×20, python ×3}`. Alphabetical tie-break keeps the + * message deterministic across filesystems. + */ +function renderDistribution(counts: Readonly>): string { + const parts = Object.keys(counts) + .sort((a, b) => counts[b] - counts[a] || a.localeCompare(b)) + .map((language) => `${language} ×${counts[language]}`); + return `{${parts.join(', ')}}`; +} + function detect(spec: Spec, cwd: string): readonly DriftFinding[] { - const detected = detectToolchain(cwd).language; - if (detected === 'unknown') { + const declared = spec.project?.language ?? ''; + // Rule 1 — a language cladding has no vocabulary for cannot be judged. + if (!LANGUAGE_VOCABULARY.has(declared)) return []; + + const evidence = classifySources(cwd); + // Rule 2 — too few classified files to assert anything about the tree. + if (evidence.classified < EVIDENCE_FLOOR) return []; + + // Rule 3 — declared language is nowhere in the tree: an active contradiction. + if (!evidence.set.includes(declared)) { + return [ + { + detector: NAME, + severity: 'warn', + message: + `spec.project.language='${declared}' but the observed sources are ` + + `${renderDistribution(evidence.counts)} — the spec no longer matches the tree`, + }, + ]; + } + + // Rule 4 — present but a sliver: disclose the share, never block on it. + if (evidence.share(declared) < MINORITY_SHARE) { return [ { detector: NAME, severity: 'info', - message: 'no manifest matched — language cannot be cross-checked', + message: + `spec.project.language='${declared}' is a minority of observed sources ` + + `(${evidence.counts[declared]}/${evidence.classified}) — disclosed, not blocking`, }, ]; } - if (spec.project.language === detected) return []; - return [ - { - detector: NAME, - severity: 'warn', - message: - `spec.project.language='${spec.project.language}' but the manifest` + - ` chain detects '${detected}'`, - }, - ]; + + // Rule 5 — declared language is a majority or plural presence: nothing to say. + return []; } export const techStackMismatch: DriftDetector = { diff --git a/src/ui/softShell.ts b/src/ui/softShell.ts index 29a4a0cc..d57dc8d8 100644 --- a/src/ui/softShell.ts +++ b/src/ui/softShell.ts @@ -145,7 +145,7 @@ export const DETECTOR_PLAIN: Readonly> = { ARCHITECTURE_VIOLATION: {lead: 'The code has an import loop or crosses a layer boundary the design forbids', action: 'break the import cycle or remove the disallowed import'}, MISSING_IMPLEMENTATION: {lead: 'The spec lists a file that is not on disk yet', action: 'create the file, or remove it from the feature module list'}, UNMAPPED_ARTIFACT: {lead: 'A source file exists that no feature in the spec claims', action: 'add it to a feature module list, or delete the file'}, - TECH_STACK_MISMATCH: {lead: 'The spec names one programming language but the code looks like another', action: 'update project.language in the spec to match the code'}, + TECH_STACK_MISMATCH: {lead: 'The spec names one programming language but the source files on disk are another', action: 'update project.language to a language the source tree actually contains'}, STATUS_DRIFT: {lead: 'A feature is marked done but its files or checks do not back that up', action: 'add the missing modules, or set the status back'}, STALE_SPECIFICATION: {lead: "A feature's lifecycle labels don't match its actual state", action: 'reconcile the feature status and archive fields'}, REFERENCE_INTEGRITY: {lead: 'The spec points to a feature id that does not exist', action: 'fix the reference or add the missing feature'}, diff --git a/tests/core/language-evidence.test.ts b/tests/core/language-evidence.test.ts new file mode 100644 index 00000000..e690b3d1 --- /dev/null +++ b/tests/core/language-evidence.test.ts @@ -0,0 +1,142 @@ +// Cladding · unit tests for core/language-evidence.ts +// +// Contract under test is AC-1c7a90b2 of F-9e1279d4: ONE foundation module +// owns the extension→language vocabulary and the observed source +// distribution, so the scan layer (cli) and the drift detectors (stages) +// can never read different tables. +// +// What the tests pin: +// - the vocabulary object the scan layer imports IS the core one +// (identity, not a copy that can drift); +// - classification counts per language, the sorted observed set, the +// dominant language, and share() as counts/classified; +// - the walk skips vendored/generated directories (node_modules et al.) +// and every dot-directory, so build output cannot outvote source; +// - extensions outside the vocabulary are ignored, and an empty tree +// yields classified 0 / dominant null / share 0 rather than a throw; +// - the walk is capped, so a detector invoking it on every gate run +// stays bounded (asserted through the exported cap + the injectable +// `maxFiles` override — 20 000 real files are never created). + +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {afterEach, beforeEach, describe, expect, test} from 'vitest'; + +import { + classifySources, + EXT_TO_LANGUAGE, + LANGUAGE_VOCABULARY, + MAX_FILES, +} from '../../src/core/language-evidence.js'; +import {EXT_TO_LANGUAGE as SCAN_EXT_TO_LANGUAGE} from '../../src/cli/scan/thresholds.js'; + +/** Writes `count` files named `f0..f` with `ext` under `dir/`. */ +function seed(dir: string, sub: string, ext: string, count: number): void { + const target = join(dir, sub); + mkdirSync(target, {recursive: true}); + for (let i = 0; i < count; i += 1) { + writeFileSync(join(target, `f${i}${ext}`), '// x\n'); + } +} + +describe('core/language-evidence — shared vocabulary', () => { + test('AC-1c7a90b2 — the scan layer re-exports the core map itself, not a copy', () => { + expect(SCAN_EXT_TO_LANGUAGE).toBe(EXT_TO_LANGUAGE); + }); + + test('AC-1c7a90b2 — the vocabulary is exactly the label set of the map', () => { + expect([...LANGUAGE_VOCABULARY].sort()).toEqual([...new Set(Object.values(EXT_TO_LANGUAGE))].sort()); + for (const label of ['typescript', 'python', 'kotlin', 'cpp', 'rust', 'go']) { + expect(LANGUAGE_VOCABULARY.has(label), label).toBe(true); + } + expect(LANGUAGE_VOCABULARY.has('zig')).toBe(false); + }); +}); + +describe('core/language-evidence — classifySources', () => { + let dir: string; + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-langev-')); + }); + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('AC-1c7a90b2 — counts per language, sorted set, dominant, and share', () => { + seed(dir, join('src', 'app'), '.ts', 6); + seed(dir, join('src', 'native'), '.cpp', 2); + seed(dir, 'scripts', '.py', 2); + + const evidence = classifySources(dir); + + expect(evidence.counts).toEqual({typescript: 6, cpp: 2, python: 2}); + expect(evidence.classified).toBe(10); + expect(evidence.set).toEqual(['cpp', 'python', 'typescript']); + expect(evidence.dominant).toBe('typescript'); + expect(evidence.share('typescript')).toBeCloseTo(0.6, 10); + expect(evidence.share('cpp')).toBeCloseTo(0.2, 10); + expect(evidence.share('ruby')).toBe(0); + }); + + test('AC-1c7a90b2 — one language across several extensions folds into one label', () => { + seed(dir, 'a', '.ts', 2); + seed(dir, 'b', '.tsx', 3); + const evidence = classifySources(dir); + expect(evidence.counts).toEqual({typescript: 5}); + expect(evidence.set).toEqual(['typescript']); + expect(evidence.share('typescript')).toBe(1); + }); + + test('AC-1c7a90b2 — vendored, generated and dot directories are skipped', () => { + seed(dir, join('src', 'app'), '.ts', 3); + // Each of these would outvote the real source if it were walked. + for (const skipped of ['node_modules', 'dist', 'build', 'out', 'coverage', 'target', 'vendor', '.cladding', '.git', '.venv']) { + seed(dir, join(skipped, 'pkg'), '.py', 4); + } + + const evidence = classifySources(dir); + + expect(evidence.counts).toEqual({typescript: 3}); + expect(evidence.set).toEqual(['typescript']); + expect(evidence.dominant).toBe('typescript'); + expect(evidence.share('python')).toBe(0); + }); + + test('AC-1c7a90b2 — extensions outside the vocabulary are ignored', () => { + seed(dir, 'src', '.ts', 2); + seed(dir, 'docs', '.md', 9); + seed(dir, 'assets', '.png', 5); + writeFileSync(join(dir, 'Makefile'), 'all:\n'); + + const evidence = classifySources(dir); + + expect(evidence.classified).toBe(2); + expect(evidence.counts).toEqual({typescript: 2}); + }); + + test('AC-1c7a90b2 — an empty tree classifies nothing and never throws', () => { + const evidence = classifySources(dir); + expect(evidence.classified).toBe(0); + expect(evidence.counts).toEqual({}); + expect(evidence.set).toEqual([]); + expect(evidence.dominant).toBeNull(); + expect(evidence.share('typescript')).toBe(0); + }); + + test('AC-1c7a90b2 — a directory that does not exist yields empty evidence', () => { + const evidence = classifySources(join(dir, 'nope')); + expect(evidence.classified).toBe(0); + expect(evidence.dominant).toBeNull(); + }); + + test('AC-1c7a90b2 — the walk is capped so a per-gate call stays bounded', () => { + expect(MAX_FILES).toBe(20_000); + + seed(dir, 'src', '.ts', 12); + // Same tree, tiny injected cap: the walk stops instead of classifying all 12. + const capped = classifySources(dir, {maxFiles: 4}); + expect(capped.classified).toBe(4); + expect(classifySources(dir).classified).toBe(12); + }); +}); diff --git a/tests/stages/tech-stack-mismatch-evidence.test.ts b/tests/stages/tech-stack-mismatch-evidence.test.ts new file mode 100644 index 00000000..113e3529 --- /dev/null +++ b/tests/stages/tech-stack-mismatch-evidence.test.ts @@ -0,0 +1,319 @@ +// Cladding · impl-blind oracle for F-9e1279d4 — authored from the spec contract only. +import {afterEach, describe, expect, test} from 'vitest'; +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {techStackMismatch} from '../../src/stages/detectors/tech-stack-mismatch.js'; + +/** + * Contract under test (D8), encoded without sight of the implementation: + * + * 1. declared language not a known label -> no findings + * 2. fewer than 5 classifiable source files -> no findings + * 3. declared language absent from observed sources -> exactly 1 finding, 'warn', + * message names declared + dominant observed + * 4. declared observed but under 10% of sources -> exactly 1 finding, 'info' + * 5. otherwise -> no findings + * 6. build manifests have no influence on the outcome + * 7. severity 'error' is never produced + */ + +type FileSpec = readonly [count: number, ext: string]; + +type Expectation = + | {readonly kind: 'none'} + | {readonly kind: 'warn' | 'info'; readonly contains?: readonly string[]}; + +interface Fixture { + readonly language: string; + readonly files: readonly FileSpec[]; + readonly manifests?: readonly string[]; +} + +interface Row extends Fixture { + readonly id: number; + readonly why: string; + readonly expect: Expectation; +} + +const tempDirs: string[] = []; + +function makeFixture(fixture: Fixture): string { + const dir = mkdtempSync(join(tmpdir(), 'tsm-')); + tempDirs.push(dir); + + writeFileSync( + join(dir, 'spec.yaml'), + `schema: "0.1"\nproject: {name: x, language: ${fixture.language}}\nfeatures: []\n`, + 'utf8', + ); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + + const srcDir = join(dir, 'src', 'pkg'); + mkdirSync(srcDir, {recursive: true}); + let seq = 0; + for (const [count, ext] of fixture.files) { + for (let n = 0; n < count; n++) { + seq++; + writeFileSync(join(srcDir, `f${seq}.${ext}`), `// f${seq}\n`, 'utf8'); + } + } + + for (const manifest of fixture.manifests ?? []) { + writeFileSync(join(dir, manifest), '', 'utf8'); + } + + return dir; +} + +function runOn(fixture: Fixture): ReadonlyArray<{ + detector: string; + severity: string; + message: string; +}> { + const cwd = makeFixture(fixture); + return techStackMismatch.run({cwd}) as ReadonlyArray<{ + detector: string; + severity: string; + message: string; + }>; +} + +afterEach(() => { + while (tempDirs.length > 0) { + const dir = tempDirs.pop(); + if (dir) rmSync(dir, {recursive: true, force: true}); + } +}); + +const rows: readonly Row[] = [ + { + id: 1, + language: 'cpp', + files: [[12, 'cpp'], [6, 'h'], [3, 'java']], + manifests: ['build.gradle'], + why: 'declared cpp dominates the observed sources', + expect: {kind: 'none'}, + }, + { + id: 2, + language: 'kotlin', + files: [[24, 'kt'], [4, 'cpp'], [2, 'java']], + manifests: ['build.gradle.kts'], + why: 'declared kotlin dominates the observed sources', + expect: {kind: 'none'}, + }, + { + id: 3, + language: 'typescript', + files: [[20, 'ts'], [6, 'java'], [4, 'swift'], [3, 'kt']], + manifests: ['package.json'], + why: 'declared typescript dominates a polyglot tree', + expect: {kind: 'none'}, + }, + { + id: 4, + language: 'javascript', + files: [[14, 'js']], + manifests: ['package.json'], + why: 'declared javascript is the only observed language', + expect: {kind: 'none'}, + }, + { + id: 5, + language: 'csharp', + files: [[16, 'cs']], + manifests: [], + why: 'declared csharp is the only observed language, no manifest at all', + expect: {kind: 'none'}, + }, + { + id: 6, + language: 'scala', + files: [[12, 'scala']], + manifests: ['build.sbt'], + why: 'declared scala is the only observed language', + expect: {kind: 'none'}, + }, + { + id: 7, + language: 'rust', + files: [[15, 'rs']], + manifests: ['package.json'], + why: 'declared rust matches sources; a node manifest must not sway the verdict', + expect: {kind: 'none'}, + }, + { + id: 8, + language: 'zig', + files: [[16, 'zig']], + manifests: [], + why: 'declared label is not a known language', + expect: {kind: 'none'}, + }, + { + id: 9, + language: 'nim', + files: [[10, 'nim'], [6, 'ts']], + manifests: ['package.json'], + why: 'declared label is not a known language, even with known sources present', + expect: {kind: 'none'}, + }, + { + id: 10, + language: 'python', + files: [[38, 'zig'], [2, 'ts']], + manifests: ['package.json'], + why: 'only 2 classifiable files — evidence below the floor of 5', + expect: {kind: 'none'}, + }, + { + id: 11, + language: 'python', + files: [[40, 'ipynb'], [2, 'ts']], + manifests: [], + why: 'notebooks are invisible; only 2 classifiable files', + expect: {kind: 'none'}, + }, + { + id: 12, + language: 'cpp', + files: [[10, 'c'], [4, 'h']], + manifests: [], + why: '.c is unknown, so only 4 classifiable files — below the floor', + expect: {kind: 'none'}, + }, + { + id: 13, + language: 'python', + files: [[20, 'ts']], + manifests: ['package.json'], + why: 'declared python absent from an all-typescript tree', + expect: {kind: 'warn', contains: ['python', 'typescript']}, + }, + { + id: 14, + language: 'typescript', + files: [[18, 'go']], + manifests: ['go.mod'], + why: 'declared typescript absent from an all-go tree', + expect: {kind: 'warn', contains: ['typescript', 'go']}, + }, + { + id: 15, + language: 'java', + files: [[25, 'kt']], + manifests: ['build.gradle.kts'], + why: 'declared java absent from an all-kotlin tree', + expect: {kind: 'warn', contains: ['java', 'kotlin']}, + }, + { + id: 16, + language: 'python', + files: [[38, 'zig'], [10, 'ts']], + manifests: ['package.json'], + why: 'unknown files are invisible; the 10 typescript files clear the floor of 5', + expect: {kind: 'warn', contains: ['python', 'typescript']}, + }, + { + id: 17, + language: 'python', + files: [[22, 'ts'], [2, 'py']], + manifests: ['package.json'], + why: 'declared python present but 2/24 ~= 8.3% of sources', + expect: {kind: 'info'}, + }, + { + id: 18, + language: 'cpp', + files: [[60, 'kt'], [3, 'cpp']], + manifests: ['build.gradle'], + why: 'declared cpp present but 3/63 ~= 4.8% of sources', + expect: {kind: 'info'}, + }, + { + id: 19, + language: 'typescript', + files: [[3, 'ts'], [30, 'js']], + manifests: ['package.json'], + why: 'declared typescript present but 3/33 ~= 9.1% of sources', + expect: {kind: 'info'}, + }, + { + id: 20, + language: 'java', + files: [[20, 'java'], [8, 'kt']], + manifests: ['build.gradle'], + why: 'declared java holds a ~71% majority', + expect: {kind: 'none'}, + }, +] as const; + +describe('TECH_STACK_MISMATCH — evidence-based conformance table (F-9e1279d4)', () => { + for (const row of rows) { + const label = `row ${row.id}: declared ${row.language} -> ${row.expect.kind} (${row.why})`; + + test(label, () => { + const findings = runOn(row); + + expect(Array.isArray(findings)).toBe(true); + for (const finding of findings) { + expect(finding.detector).toBe('TECH_STACK_MISMATCH'); + expect(finding.severity).not.toBe('error'); + } + + if (row.expect.kind === 'none') { + expect(findings).toEqual([]); + return; + } + + expect(findings).toHaveLength(1); + const [finding] = findings; + expect(finding.severity).toBe(row.expect.kind); + expect(typeof finding.message).toBe('string'); + + for (const needle of row.expect.contains ?? []) { + expect(finding.message.toLowerCase()).toContain(needle); + } + }); + } + + test('build manifests never influence the outcome (row 13 with and without package.json)', () => { + const withManifest = runOn({ + language: 'python', + files: [[20, 'ts']], + manifests: ['package.json'], + }); + const withoutManifest = runOn({ + language: 'python', + files: [[20, 'ts']], + manifests: [], + }); + + const shape = ( + findings: ReadonlyArray<{detector: string; severity: string; message: string}>, + ) => findings.map((f) => ({detector: f.detector, severity: f.severity, message: f.message})); + + expect(shape(withoutManifest)).toEqual(shape(withManifest)); + expect(withManifest).toHaveLength(1); + expect(withManifest[0].severity).toBe('warn'); + }); + + test("no row of the table ever produces severity 'error'", () => { + const produced: Array<{detector: string; severity: string}> = []; + + for (const row of rows) { + for (const finding of runOn(row)) { + produced.push({detector: finding.detector, severity: finding.severity}); + } + } + + // The table has 4 warn rows + 3 info rows, so the detector must speak exactly 7 times. + expect(produced).toHaveLength(7); + for (const finding of produced) { + expect(finding.detector).toBe('TECH_STACK_MISMATCH'); + expect(finding.severity).not.toBe('error'); + expect(['warn', 'info']).toContain(finding.severity); + } + }); +}); diff --git a/tests/stages/tech-stack-mismatch.test.ts b/tests/stages/tech-stack-mismatch.test.ts index b501e2c6..0a5ed03f 100644 --- a/tests/stages/tech-stack-mismatch.test.ts +++ b/tests/stages/tech-stack-mismatch.test.ts @@ -1,19 +1,25 @@ // Cladding · unit tests for stages/detectors/tech-stack-mismatch.ts // -// Detector under test cross-checks `spec.project.language` against the -// language `detectToolchain` resolves by walking the project's manifest -// chain. The three reachable outcomes: +// Detector under test compares `spec.project.language` against the source +// files actually on disk (core/language-evidence.ts) — never against the +// build-manifest chain. Outcome table (F-9e1279d4): // -// - languages agree → no finding -// - languages differ → warn finding (typo / unported drift) -// - manifest chain returns -// 'unknown' (no manifest) → info finding (cannot cross-check) +// declared language outside the vocabulary → nothing (AC-3f8e6d15) +// fewer than 5 classified source files → nothing (AC-3f8e6d15) +// declared absent from the observed set → one warn, naming the +// declared language and +// the observed counts +// (AC-5b2d47c9) +// declared observed but under 10% of sources → one info, naming the +// share; never blocking +// (AC-8d94a1e6) +// declared at or above 10% of sources → nothing (AC-e07c3241) // -// 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 -// priority chain at the cladding-detector level — the chain itself has -// dedicated coverage in tests/stages/toolchain.test.ts. +// The manifest chain is deliberately not consulted for identity, so a +// package.json / build.gradle in the fixture must not move any outcome — +// that invariant is asserted directly. Fixtures write ≥5 real source files +// under /src/pkg/ so the evidence floor is genuinely cleared rather +// than mocked. import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; @@ -30,6 +36,15 @@ function writeSpec(dir: string, language: string): void { mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); } +/** Writes `count` source files with `ext` under /src/pkg (prefix keeps names unique). */ +function writeSources(dir: string, ext: string, count: number, prefix = 'f'): void { + const target = join(dir, 'src', 'pkg'); + mkdirSync(target, {recursive: true}); + for (let i = 0; i < count; i += 1) { + writeFileSync(join(target, `${prefix}${i}${ext}`), '// source\n'); + } +} + describe('TECH_STACK_MISMATCH detector', () => { let dir: string; beforeEach(() => { @@ -39,47 +54,145 @@ describe('TECH_STACK_MISMATCH detector', () => { rmSync(dir, {recursive: true, force: true}); }); - test('silent when spec language matches the detected manifest', () => { + test('AC-e07c3241 — silent when the declared language is the majority of sources', () => { writeSpec(dir, 'typescript'); - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + writeSources(dir, '.ts', 8); expect(techStackMismatch.run({cwd: dir})).toEqual([]); }); - test('emits warn when spec language differs from the detected manifest', () => { + test('AC-e07c3241 — silent on a normal polyglot where the declared language is a plural presence', () => { + // Android-shaped: Kotlin app with an NDK C++ core. Declared kotlin is + // well above the minority band, so nothing is said. + writeSpec(dir, 'kotlin'); + writeSources(dir, '.kt', 10, 'k'); + writeSources(dir, '.cpp', 4, 'n'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('AC-5b2d47c9 — warns when the declared language is absent from the tree', () => { writeSpec(dir, 'python'); - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + writeSources(dir, '.ts', 6); + const findings = techStackMismatch.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].detector).toBe('TECH_STACK_MISMATCH'); expect(findings[0].severity).toBe('warn'); + // names the declared language, the observed language, and the evidence count expect(findings[0].message).toContain("'python'"); - expect(findings[0].message).toContain("'typescript'"); + expect(findings[0].message).toContain('typescript'); + expect(findings[0].message).toContain('×6'); }); - test('emits info when no manifest matches at all', () => { - writeSpec(dir, 'typescript'); - // intentionally no package.json, no pyproject.toml, etc. + test('AC-5b2d47c9 — the warn lists every observed language, most-seen first', () => { + writeSpec(dir, 'python'); + writeSources(dir, '.ts', 6); + writeSources(dir, '.go', 2, 'g'); + + const findings = techStackMismatch.run({cwd: dir}); + + expect(findings).toHaveLength(1); + expect(findings[0].message).toContain('{typescript ×6, go ×2}'); + }); + + test('AC-8d94a1e6 — a declared language under 10% of sources is info, never blocking', () => { + // Thin native SDK: 1 C++ file under 19 TypeScript files = 5%. + writeSpec(dir, 'cpp'); + writeSources(dir, '.ts', 19); + writeSources(dir, '.cpp', 1, 'n'); + const findings = techStackMismatch.run({cwd: dir}); + expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('info'); - expect(findings[0].message).toContain('no manifest matched'); + expect(findings[0].message).toContain("'cpp'"); + expect(findings[0].message).toContain('(1/20)'); + }); + + test('AC-8d94a1e6 — the detector never emits an error severity', () => { + for (const [language, ext, count] of [['python', '.ts', 6], ['cpp', '.ts', 19]] as const) { + const local = mkdtempSync(join(tmpdir(), 'clad-tsm-sev-')); + try { + writeSpec(local, language); + writeSources(local, ext, count); + if (language === 'cpp') writeSources(local, '.cpp', 1, 'n'); + for (const finding of techStackMismatch.run({cwd: local})) { + expect(finding.severity).not.toBe('error'); + } + } finally { + rmSync(local, {recursive: true, force: true}); + } + } + }); + + test('AC-e07c3241 — exactly at the 10% threshold is silence, not disclosure', () => { + // 2 of 20 = 10% — the band is "under 10%", so the boundary stays quiet. + writeSpec(dir, 'cpp'); + writeSources(dir, '.ts', 18); + writeSources(dir, '.cpp', 2, 'n'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('AC-3f8e6d15 — a language outside the vocabulary produces nothing', () => { + // cladding has no extension mapping for zig; ignorance is not drift, + // even though the tree is unambiguously TypeScript. + writeSpec(dir, 'zig'); + writeSources(dir, '.ts', 8); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); }); - test('package.json wins over pyproject.toml (priority chain)', () => { - // Both manifests present → priority chain returns the first match, - // which is package.json (typescript). Spec says python → mismatch - // confirms the priority order. + test('AC-3f8e6d15 — fewer than 5 classified source files produces nothing', () => { writeSpec(dir, 'python'); - writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); - writeFileSync(join(dir, 'pyproject.toml'), '[project]\nname = "x"\n'); + writeSources(dir, '.ts', 4); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('AC-3f8e6d15 — the fifth file is the first that can carry an assertion', () => { + writeSpec(dir, 'python'); + writeSources(dir, '.ts', 5); const findings = techStackMismatch.run({cwd: dir}); expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('warn'); - expect(findings[0].message).toContain("'typescript'"); }); - test('absent spec.yaml emits one info finding (not a throw)', () => { - // No spec.yaml at all; package.json still present. + test('AC-3f8e6d15 — a docs-only tree with no source files produces nothing', () => { + writeSpec(dir, 'typescript'); + mkdirSync(join(dir, 'docs'), {recursive: true}); + writeFileSync(join(dir, 'docs', 'guide.md'), '# guide\n'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('AC-e07c3241 — a build manifest cannot contradict the sources', () => { + // Old contract: package.json resolved "typescript" and warned against a + // python spec even with zero source files. New contract: the manifest is + // not consulted at all, so a truthful python tree stays silent. + writeSpec(dir, 'python'); + writeSources(dir, '.py', 6); writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + writeFileSync(join(dir, 'build.gradle'), 'plugins {}\n'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('AC-e07c3241 — adding or removing manifests leaves the outcome identical', () => { + writeSpec(dir, 'python'); + writeSources(dir, '.ts', 6); + const withoutManifest = techStackMismatch.run({cwd: dir}); + writeFileSync(join(dir, 'package.json'), '{"name":"x"}\n'); + writeFileSync(join(dir, 'pyproject.toml'), '[project]\nname = "x"\n'); + expect(techStackMismatch.run({cwd: dir})).toEqual(withoutManifest); + }); + + test('AC-e07c3241 — vendored dependencies cannot outvote the real sources', () => { + writeSpec(dir, 'typescript'); + writeSources(dir, '.ts', 6); + const vendored = join(dir, 'node_modules', 'left-pad'); + mkdirSync(vendored, {recursive: true}); + for (let i = 0; i < 40; i += 1) writeFileSync(join(vendored, `v${i}.py`), '# vendored\n'); + expect(techStackMismatch.run({cwd: dir})).toEqual([]); + }); + + test('absent spec.yaml emits one info finding (not a throw)', () => { + writeSources(dir, '.ts', 6); const findings = techStackMismatch.run({cwd: dir}); expect(findings).toHaveLength(1); expect(findings[0].severity).toBe('info'); From 42bdb398713ebcc92ba76a485f5f5daf2194d20e Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 15:02:49 +0900 Subject: [PATCH 2/6] feat(detectors): evidence-derived scan universe for UNMAPPED_ARTIFACT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The module-honesty check chose one extension from a six-language table; declaring cpp, java, or csharp fell through to *.ts, scanned zero files, and passed vacuously — verified by direct scanPatterns calls — on exactly the projects the check exists for. The universe is now derived from evidence: extensions observed in the tree that the shared vocabulary knows, united with extensions of modules claimed under layer roots, so an unknown language (.zig) enters the moment a feature claims it, with no table growth. Scan roots are likewise inferred from claimed module paths (src/main/kotlin comes out of inference), retiring both EXT_BY_LANGUAGE and ROOT_BY_LANGUAGE; the detector no longer reads spec.project.language at all. Root inference alone would over-teach — layer names recur under tests/, skills/, and plugins/, which measured 430 false findings on this repository — so a root must carry at least 25% of layer-claimed modules. The accepted trades (a sub-25% genuine root is not scanned; the share is ratio-noisy at tiny claim counts) are recorded in the spec entry. On this repo the new universe is 133 patterns / 201 files (was 19 / 190) with zero new findings, and the A/B golden scenarios now catch their injected rename drift through UNMAPPED_ARTIFACT as well — the .tsx rename the old table could not see. Verified: 9-test impl-blind oracle (contract-only), 22 unit tests, adversarial root-filter attacks (collision drop at scale, 50/50 dual-root survival, documented 80/20 miss), full suite 2909/2909. F-87bb7ed3 · clad done under a GREEN strict pre-push gate Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- .../scenarios/dashboard/report.md | 2 +- .../scenarios/task-manager/report.md | 2 +- plugins/claude-code/dist/clad.js | 708 +++++++++--------- spec.yaml | 4 +- spec/attestation.yaml | 27 +- ...elf-describing-scan-universe-87bb7ed3.yaml | 72 ++ spec/index.yaml | 1 + src/core/language-evidence.ts | 85 ++- src/stages/detectors/README.md | 2 +- src/stages/detectors/unmapped-artifact.ts | 157 +++- tests/core/language-evidence.test.ts | 48 +- tests/stages/unmapped-artifact.test.ts | 292 ++++++-- .../stages/unmapped-universe-evidence.test.ts | 258 +++++++ 19 files changed, 1202 insertions(+), 480 deletions(-) create mode 100644 spec/features/self-describing-scan-universe-87bb7ed3.yaml create mode 100644 tests/stages/unmapped-universe-evidence.test.ts diff --git a/README.html b/README.html index 7c5e13e5..ce72e4f7 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

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

Status

tests
-
2886/2886
+
2909/2909
all pass
diff --git a/README.ja.md b/README.ja.md index 205fc350..379da19f 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) | 2886 / 2886 | 15 段階 · 41 detectors | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2909 / 2909 | 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 63923819..eb1c56d7 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
-
2886/2886
+
2909/2909
all pass
diff --git a/README.ko.md b/README.ko.md index 7ffc2d7e..a78a0892 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) | 2886 / 2886 · 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) | 2909 / 2909 · 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 dd494d0e..7e15e265 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) | 2886 / 2886 | 15 stages · 41 detectors | 277 (273 done) | +| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2909 / 2909 | 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 0f9ba050..782f3150 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) | 2886 / 2886 | 15 阶段 · 41 检测器 | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2909 / 2909 | 15 阶段 · 41 检测器 | 277(273 done) | 253 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/ab-evaluation-extended/scenarios/dashboard/report.md b/docs/ab-evaluation-extended/scenarios/dashboard/report.md index b6ae05d1..38f19e54 100644 --- a/docs/ab-evaluation-extended/scenarios/dashboard/report.md +++ b/docs/ab-evaluation-extended/scenarios/dashboard/report.md @@ -67,7 +67,7 @@ Four deterministic drift scenarios injected at feature-30 state. "Caught" = at l | Scenario | A (Cladding) caught? | A new detectors | B (Vanilla) caught? | B new detectors | |---|:---:|---|:---:|---| -| DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, STATUS_DRIFT | · | — | +| DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, UNMAPPED_ARTIFACT, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/lib/filter.ts imports ../components/Header) | ✅ | ARCHITECTURE_FROM_SPEC, INFERABLE_DEPENDS_ON | · | — | | DI-3 Hardcoded secret (add API key constant to src/lib/export-config.ts) | · | — | · | — | | DI-4 Untested AC (add AC-003 to spec/features/metric-card-2ed463.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | diff --git a/docs/ab-evaluation-extended/scenarios/task-manager/report.md b/docs/ab-evaluation-extended/scenarios/task-manager/report.md index def634e6..f19f960f 100644 --- a/docs/ab-evaluation-extended/scenarios/task-manager/report.md +++ b/docs/ab-evaluation-extended/scenarios/task-manager/report.md @@ -69,7 +69,7 @@ Four deterministic drift scenarios injected at feature-30 state. "Caught" = at l | Scenario | A (Cladding) caught? | A new detectors | B (Vanilla) caught? | B new detectors | |---|:---:|---|:---:|---| -| DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, STATUS_DRIFT | · | — | +| DI-1 Stale module reference (rename src/components/Header.tsx → src/components/Header.RENAMED.tsx without spec update) | ✅ | MISSING_IMPLEMENTATION, UNMAPPED_ARTIFACT, STATUS_DRIFT | · | — | | DI-2 Architecture violation (src/lib/filter.ts imports ../components/Header) | ✅ | ARCHITECTURE_FROM_SPEC, INFERABLE_DEPENDS_ON | · | — | | DI-3 Hardcoded secret (add API key constant to src/lib/export-import.ts) | · | — | · | — | | DI-4 Untested AC (add AC-003 to spec/features/add-task-3cbf38.yaml without test) | ✅ | MISSING_TESTS | N/A | N/A | diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 4e3886f7..2b8e429d 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,65 +4,65 @@ 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 kfe=Object.create;var FA=Object.defineProperty;var Efe=Object.getOwnPropertyDescriptor;var Afe=Object.getOwnPropertyNames;var Tfe=Object.getPrototypeOf,Ofe=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)FA(t,r,{get:e[r],enumerable:!0})},Rfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Afe(e))!Ofe.call(t,i)&&i!==r&&FA(t,i,{get:()=>e[i],enumerable:!(n=Efe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?kfe(Tfe(t)):{},Rfe(e||!t||!t.__esModule?FA(r,"default",{value:t,enumerable:!0}):r,t));var df=v(zA=>{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}},LA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};zA.CommanderError=Ty;zA.InvalidArgumentError=LA});var Oy=v(qA=>{var{InvalidArgumentError:Ife}=df(),UA=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 Ife(`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 Pfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}qA.Argument=UA;qA.humanReadableArgName=Pfe});var GA=v(BA=>{var{humanReadableArgName:Cfe}=Oy(),HA=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=>Cfe(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 Tfe=Object.create;var LA=Object.defineProperty;var Ofe=Object.getOwnPropertyDescriptor;var Rfe=Object.getOwnPropertyNames;var Ife=Object.getPrototypeOf,Pfe=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)LA(t,r,{get:e[r],enumerable:!0})},Cfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rfe(e))!Pfe.call(t,i)&&i!==r&&LA(t,i,{get:()=>e[i],enumerable:!(n=Ofe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?Tfe(Ife(t)):{},Cfe(e||!t||!t.__esModule?LA(r,"default",{value:t,enumerable:!0}):r,t));var df=v(UA=>{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}},zA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};UA.CommanderError=Ty;UA.InvalidArgumentError=zA});var Oy=v(HA=>{var{InvalidArgumentError:Dfe}=df(),qA=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 Dfe(`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 Nfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}HA.Argument=qA;HA.humanReadableArgName=Nfe});var ZA=v(GA=>{var{humanReadableArgName:jfe}=Oy(),BA=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=>jfe(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 P4(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 P4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}BA.Help=HA;BA.stripColor=P4});var KA=v(WA=>{var{InvalidArgumentError:Dfe}=df(),ZA=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=Nfe(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 Dfe(`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?C4(this.name().replace(/^no-/,"")):C4(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}},VA=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 C4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Nfe(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 P4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}GA.Help=BA;GA.stripColor=P4});var JA=v(KA=>{var{InvalidArgumentError:Mfe}=df(),VA=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=Ffe(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 Mfe(`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?C4(this.name().replace(/^no-/,"")):C4(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}},WA=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 C4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Ffe(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} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}WA.Option=ZA;WA.DualOptions=VA});var N4=v(D4=>{function jfe(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 Mfe(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=jfe(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?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}KA.Option=VA;KA.DualOptions=WA});var N4=v(D4=>{function Lfe(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 zfe(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=Lfe(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]}?)`:""}D4.suggestSimilar=Mfe});var L4=v(eT=>{var Ffe=Ge("node:events").EventEmitter,JA=Ge("node:child_process"),mo=Ge("node:path"),Ry=Ge("node:fs"),He=Ge("node:process"),{Argument:Lfe,humanReadableArgName:zfe}=Oy(),{CommanderError:YA}=df(),{Help:Ufe,stripColor:qfe}=GA(),{Option:j4,DualOptions:Hfe}=KA(),{suggestSimilar:M4}=N4(),XA=class t extends Ffe{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:()=>QA()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>QA()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>qfe(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 Ufe,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 Lfe(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 YA(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 j4(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}' +(Did you mean ${n[0]}?)`:""}D4.suggestSimilar=zfe});var L4=v(tT=>{var Ufe=Ge("node:events").EventEmitter,YA=Ge("node:child_process"),mo=Ge("node:path"),Ry=Ge("node:fs"),He=Ge("node:process"),{Argument:qfe,humanReadableArgName:Hfe}=Oy(),{CommanderError:XA}=df(),{Help:Bfe,stripColor:Gfe}=ZA(),{Option:j4,DualOptions:Zfe}=JA(),{suggestSimilar:M4}=N4(),QA=class t extends Ufe{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:()=>eT()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>eT()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Gfe(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 Bfe,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 qfe(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 XA(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 j4(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 j4)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(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(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=F4(He.execArgv).concat(r),c=JA.spawn(He.argv[0],r,{stdio:"inherit"})):c=JA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=F4(He.execArgv).concat(r),c=JA.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 YA(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 YA(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=F4(He.execArgv).concat(r),c=YA.spawn(He.argv[0],r,{stdio:"inherit"})):c=YA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=F4(He.execArgv).concat(r),c=YA.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 XA(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 XA(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 Hfe(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=M4(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=M4(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=>zfe(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. +`),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=M4(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=M4(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=>Hfe(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 F4(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 QA(){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}eT.Command=XA;eT.useColor=QA});var H4=v(On=>{var{Argument:z4}=Oy(),{Command:tT}=L4(),{CommanderError:Bfe,InvalidArgumentError:U4}=df(),{Help:Gfe}=GA(),{Option:q4}=KA();On.program=new tT;On.createCommand=t=>new tT(t);On.createOption=(t,e)=>new q4(t,e);On.createArgument=(t,e)=>new z4(t,e);On.Command=tT;On.Option=q4;On.Argument=z4;On.Help=Gfe;On.CommanderError=Bfe;On.InvalidArgumentError=U4;On.InvalidOptionArgumentError=U4});var De=v(er=>{"use strict";var nT=Symbol.for("yaml.alias"),V4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),W4=Symbol.for("yaml.pair"),iT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),Yfe=t=>!!t&&typeof t=="object"&&t[ho]===nT,Xfe=t=>!!t&&typeof t=="object"&&t[ho]===V4,Qfe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,epe=t=>!!t&&typeof t=="object"&&t[ho]===W4,K4=t=>!!t&&typeof t=="object"&&t[ho]===iT,tpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function J4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function rpe(t){if(t&&typeof t=="object")switch(t[ho]){case nT:case Iy:case iT:case Py:return!0}return!1}var npe=t=>(K4(t)||J4(t))&&!!t.anchor;er.ALIAS=nT;er.DOC=V4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=W4;er.SCALAR=iT;er.SEQ=Py;er.hasAnchor=npe;er.isAlias=Yfe;er.isCollection=J4;er.isDocument=Xfe;er.isMap=Qfe;er.isNode=rpe;er.isPair=epe;er.isScalar=K4;er.isSeq=tpe});var ff=v(oT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),Y4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=X4(e);Ut.isDocument(t)?rl(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):rl(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=Y4;Cy.REMOVE=Ti;function rl(t,e,r,n){let i=Q4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return eH(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 tH=De(),ipe=ff(),ope={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},spe=t=>t.replace(/[!,[\]{}]/g,e=>ope[e]),pf=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+spe(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&&tH.isNode(e.contents)){let o={};ipe.visit(e.contents,(s,a)=>{tH.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(` -`)}};pf.defaultYaml={explicit:!1,version:"1.2"};pf.defaultTags={"!!":"tag:yaml.org,2002:"};rH.Directives=pf});var Ny=v(mf=>{"use strict";var nH=De(),ape=ff();function cpe(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 iH(t){let e=new Set;return ape.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function oH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function lpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=iH(t));let s=oH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(nH.isScalar(s.node)||nH.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}}mf.anchorIsValid=cpe;mf.anchorNames=iH;mf.createNodeAnchors=lpe;mf.findNewAnchor=oH});var aT=v(sH=>{"use strict";function hf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var upe=De();function aH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>aH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!upe.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}cH.toJS=aH});var jy=v(uH=>{"use strict";var dpe=aT(),lH=De(),fpe=Wo(),cT=class{constructor(e){Object.defineProperty(this,lH.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(!lH.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=fpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?dpe.applyReviver(o,{"":a},"",a):a}};uH.NodeBase=cT});var gf=v(dH=>{"use strict";var ppe=Ny(),mpe=ff(),il=De(),hpe=jy(),gpe=Wo(),lT=class extends hpe.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=[],mpe.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||(gpe.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(ppe.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(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=My(t,i,r);o>n&&(n=o)}return n}else if(il.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}dH.Alias=lT});var Dt=v(uT=>{"use strict";var ype=De(),_pe=jy(),bpe=Wo(),vpe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends _pe.NodeBase{constructor(e){super(ype.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:bpe.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";uT.Scalar=Ko;uT.isScalarValue=vpe});var yf=v(pH=>{"use strict";var Spe=gf(),ha=De(),fH=Dt(),wpe="tag:yaml.org,2002:";function xpe(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 $pe(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 Spe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=wpe+e.slice(2));let l=xpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new fH.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 fH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}pH.createNode=$pe});var Ly=v(Fy=>{"use strict";var kpe=yf(),Oi=De(),Epe=jy();function dT(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 kpe.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 mH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,fT=class extends Epe.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(mH(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,dT(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,dT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=fT;Fy.collectionFromPath=dT;Fy.isEmptyPath=mH});var _f=v(zy=>{"use strict";var Ape=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function pT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Tpe=(t,e,r)=>t.endsWith(` -`)?pT(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function F4(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 eT(){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}tT.Command=QA;tT.useColor=eT});var H4=v(On=>{var{Argument:z4}=Oy(),{Command:rT}=L4(),{CommanderError:Vfe,InvalidArgumentError:U4}=df(),{Help:Wfe}=ZA(),{Option:q4}=JA();On.program=new rT;On.createCommand=t=>new rT(t);On.createOption=(t,e)=>new q4(t,e);On.createArgument=(t,e)=>new z4(t,e);On.Command=rT;On.Option=q4;On.Argument=z4;On.Help=Wfe;On.CommanderError=Vfe;On.InvalidArgumentError=U4;On.InvalidOptionArgumentError=U4});var De=v(er=>{"use strict";var iT=Symbol.for("yaml.alias"),V4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),W4=Symbol.for("yaml.pair"),oT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),epe=t=>!!t&&typeof t=="object"&&t[ho]===iT,tpe=t=>!!t&&typeof t=="object"&&t[ho]===V4,rpe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,npe=t=>!!t&&typeof t=="object"&&t[ho]===W4,K4=t=>!!t&&typeof t=="object"&&t[ho]===oT,ipe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function J4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ope(t){if(t&&typeof t=="object")switch(t[ho]){case iT:case Iy:case oT:case Py:return!0}return!1}var spe=t=>(K4(t)||J4(t))&&!!t.anchor;er.ALIAS=iT;er.DOC=V4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=W4;er.SCALAR=oT;er.SEQ=Py;er.hasAnchor=spe;er.isAlias=epe;er.isCollection=J4;er.isDocument=tpe;er.isMap=rpe;er.isNode=ope;er.isPair=npe;er.isScalar=K4;er.isSeq=ipe});var ff=v(sT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),Y4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=X4(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=Y4;Cy.REMOVE=Ti;function nl(t,e,r,n){let i=Q4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return eH(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 tH=De(),ape=ff(),cpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lpe=t=>t.replace(/[!,[\]{}]/g,e=>cpe[e]),pf=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+lpe(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&&tH.isNode(e.contents)){let o={};ape.visit(e.contents,(s,a)=>{tH.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(` +`)}};pf.defaultYaml={explicit:!1,version:"1.2"};pf.defaultTags={"!!":"tag:yaml.org,2002:"};rH.Directives=pf});var Ny=v(mf=>{"use strict";var nH=De(),upe=ff();function dpe(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 iH(t){let e=new Set;return upe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function oH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function fpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=iH(t));let s=oH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(nH.isScalar(s.node)||nH.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}}mf.anchorIsValid=dpe;mf.anchorNames=iH;mf.createNodeAnchors=fpe;mf.findNewAnchor=oH});var cT=v(sH=>{"use strict";function hf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var ppe=De();function aH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>aH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!ppe.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}cH.toJS=aH});var jy=v(uH=>{"use strict";var mpe=cT(),lH=De(),hpe=Wo(),lT=class{constructor(e){Object.defineProperty(this,lH.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(!lH.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=hpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?mpe.applyReviver(o,{"":a},"",a):a}};uH.NodeBase=lT});var gf=v(dH=>{"use strict";var gpe=Ny(),ype=ff(),ol=De(),_pe=jy(),bpe=Wo(),uT=class extends _pe.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=[],ype.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||(bpe.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(gpe.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}dH.Alias=uT});var Dt=v(dT=>{"use strict";var vpe=De(),Spe=jy(),wpe=Wo(),xpe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Spe.NodeBase{constructor(e){super(vpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:wpe.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";dT.Scalar=Ko;dT.isScalarValue=xpe});var yf=v(pH=>{"use strict";var $pe=gf(),ha=De(),fH=Dt(),kpe="tag:yaml.org,2002:";function Epe(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 Ape(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=kpe+e.slice(2));let l=Epe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new fH.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 fH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}pH.createNode=Ape});var Ly=v(Fy=>{"use strict";var Tpe=yf(),Oi=De(),Ope=jy();function fT(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 Tpe.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 mH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pT=class extends Ope.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(mH(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,fT(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,fT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=pT;Fy.collectionFromPath=fT;Fy.isEmptyPath=mH});var _f=v(zy=>{"use strict";var Rpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ipe=(t,e,r)=>t.endsWith(` +`)?mT(r,e):r.includes(` `)?` -`+pT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=pT;zy.lineComment=Tpe;zy.stringifyComment=Ape});var gH=v(bf=>{"use strict";var Ope="flow",mT="block",Uy="quoted";function Rpe(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===mT&&(h=hH(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===mT&&(h=hH(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+mT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=mT;zy.lineComment=Ipe;zy.stringifyComment=Rpe});var gH=v(bf=>{"use strict";var Ppe="flow",hT="block",Uy="quoted";function Cpe(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===hT&&(h=hH(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===hT&&(h=hH(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===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=gH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function Ipe(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;o{"use strict";var Xn=Dt(),Jo=gH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function Dpe(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 vf(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(gT,`$&${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} ${l}${T}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} -${l}${_}${r}${p}`}function Ppe(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):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 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,Hy(e,!1))}function Cpe(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):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return vf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return hT(s.value,e);case Xn.Scalar.PLAIN:return Ppe(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}yH.stringifyString=Cpe});var wf=v(yT=>{"use strict";var Dpe=Ny(),Yo=De(),Npe=_f(),jpe=Sf();function Mpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Npe.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 Fpe(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 Lpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Dpe.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 zpe(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=Fpe(e.doc.schema.tags,o));let s=Lpe(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)?jpe.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}yT.createStringifyContext=Mpe;yT.stringify=zpe});var SH=v(vH=>{"use strict";var go=De(),_H=Dt(),bH=wf(),xf=_f();function Upe({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===_H.Scalar.BLOCK_FOLDED||t.type===_H.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=bH.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+=xf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=xf.lineComment(g,r.indent,l(f))),g=`? ${g} +${l}${_}${r}${p}`}function Npe(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 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 jpe(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 vf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return gT(s.value,e);case Xn.Scalar.PLAIN:return Npe(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}yH.stringifyString=jpe});var wf=v(_T=>{"use strict";var Mpe=Ny(),Yo=De(),Fpe=_f(),Lpe=Sf();function zpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Fpe.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 Upe(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 qpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Mpe.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 Hpe(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=Upe(e.doc.schema.tags,o));let s=qpe(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)?Lpe.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}_T.createStringifyContext=zpe;_T.stringify=Hpe});var SH=v(vH=>{"use strict";var go=De(),_H=Dt(),bH=wf(),xf=_f();function Bpe({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===_H.Scalar.BLOCK_FOLDED||t.type===_H.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=bH.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+=xf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=xf.lineComment(g,r.indent,l(f))),g=`? ${g} ${a}:`):(g=`${g}:`,f&&(g+=xf.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=bH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` `:"",_){let A=l(_);R+=` ${xf.indentComment(A,r.indent)}`}w===""&&!r.inFlow?R===` @@ -72,34 +72,34 @@ ${xf.indentComment(A,r.indent)}`}w===""&&!r.inFlow?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 wH=Ge("process");function qpe(t,...e){t==="debug"&&console.log(...e)}function Hpe(t,e){(t==="debug"||t==="warn")&&(typeof wH.emitWarning=="function"?wH.emitWarning(e):console.warn(e))}_T.debug=qpe;_T.warn=Hpe});var Ky=v(Wy=>{"use strict";var Vy=De(),xH=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 xH.Scalar(Symbol(Gy)),{addToJSMap:$H}),stringify:()=>Gy},Bpe=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===xH.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function $H(t,e,r){let n=kH(t,r);if(Vy.isSeq(n))for(let i of n.items)vT(t,e,i);else if(Array.isArray(n))for(let i of n)vT(t,e,i);else vT(t,e,n)}function vT(t,e,r){let n=kH(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 kH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=$H;Wy.isMergeKey=Bpe;Wy.merge=Zy});var wT=v(TH=>{"use strict";var Gpe=bT(),EH=Ky(),Zpe=wf(),AH=De(),ST=Wo();function Vpe(t,e,{key:r,value:n}){if(AH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(EH.isMergeKey(t,r))EH.addMergeToJSMap(t,e,n);else{let i=ST.toJS(r,"",t);if(e instanceof Map)e.set(i,ST.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Wpe(r,i,t),s=ST.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 Wpe(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(AH.isNode(t)&&r?.doc){let n=Zpe.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)+'..."'),Gpe.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)}TH.addPairToJSMap=Vpe});var Xo=v(xT=>{"use strict";var OH=yf(),Kpe=SH(),Jpe=wT(),Jy=De();function Ype(t,e,r){let n=OH.createNode(t,void 0,r),i=OH.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 Jpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Kpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};xT.Pair=Yy;xT.createPair=Ype});var $T=v(IH=>{"use strict";var ga=De(),RH=wf(),Xy=_f();function Xpe(t,e,r){return(e.inFlow??t.flow?eme:Qpe)(t,e,r)}function Qpe({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;m{"use strict";var wH=Ge("process");function Gpe(t,...e){t==="debug"&&console.log(...e)}function Zpe(t,e){(t==="debug"||t==="warn")&&(typeof wH.emitWarning=="function"?wH.emitWarning(e):console.warn(e))}bT.debug=Gpe;bT.warn=Zpe});var Ky=v(Wy=>{"use strict";var Vy=De(),xH=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 xH.Scalar(Symbol(Gy)),{addToJSMap:$H}),stringify:()=>Gy},Vpe=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===xH.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function $H(t,e,r){let n=kH(t,r);if(Vy.isSeq(n))for(let i of n.items)ST(t,e,i);else if(Array.isArray(n))for(let i of n)ST(t,e,i);else ST(t,e,n)}function ST(t,e,r){let n=kH(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 kH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=$H;Wy.isMergeKey=Vpe;Wy.merge=Zy});var xT=v(TH=>{"use strict";var Wpe=vT(),EH=Ky(),Kpe=wf(),AH=De(),wT=Wo();function Jpe(t,e,{key:r,value:n}){if(AH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(EH.isMergeKey(t,r))EH.addMergeToJSMap(t,e,n);else{let i=wT.toJS(r,"",t);if(e instanceof Map)e.set(i,wT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ype(r,i,t),s=wT.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 Ype(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(AH.isNode(t)&&r?.doc){let n=Kpe.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)+'..."'),Wpe.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)}TH.addPairToJSMap=Jpe});var Xo=v($T=>{"use strict";var OH=yf(),Xpe=SH(),Qpe=xT(),Jy=De();function eme(t,e,r){let n=OH.createNode(t,void 0,r),i=OH.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 Qpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Xpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};$T.Pair=Yy;$T.createPair=eme});var kT=v(IH=>{"use strict";var ga=De(),RH=wf(),Xy=_f();function tme(t,e,r){return(e.inFlow??t.flow?nme:rme)(t,e,r)}function rme({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(` +`+Xy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function nme({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 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())}}IH.stringifyCollection=Xpe});var es=v(ET=>{"use strict";var tme=$T(),rme=wT(),nme=Ly(),Qo=De(),e_=Xo(),ime=Dt();function $f(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 kT=class extends nme.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=$f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&ime.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=$f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=$f(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!$f(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)rme.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})),tme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};ET.YAMLMap=kT;ET.findPair=$f});var sl=v(CH=>{"use strict";var ome=De(),PH=es(),sme={collection:"map",default:!0,nodeClass:PH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return ome.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>PH.YAMLMap.from(t,e,r)};CH.map=sme});var ts=v(DH=>{"use strict";var ame=yf(),cme=$T(),lme=Ly(),r_=De(),ume=Dt(),dme=Wo(),AT=class extends lme.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}DH.YAMLSeq=AT});var al=v(jH=>{"use strict";var fme=De(),NH=ts(),pme={collection:"seq",default:!0,nodeClass:NH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return fme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>NH.YAMLSeq.from(t,e,r)};jH.seq=pme});var kf=v(MH=>{"use strict";var mme=Sf(),hme={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),mme.stringifyString(t,e,r,n)}};MH.string=hme});var n_=v(zH=>{"use strict";var FH=Dt(),LH={identify:t=>t==null,createNode:()=>new FH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new FH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&LH.test.test(t)?t:e.options.nullStr};zH.nullTag=LH});var TT=v(qH=>{"use strict";var gme=Dt(),UH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new gme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&UH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};qH.boolTag=UH});var cl=v(HH=>{"use strict";function yme({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}HH.stringifyNumber=yme});var RT=v(i_=>{"use strict";var _me=Dt(),OT=cl(),bme={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:OT.stringifyNumber},vme={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():OT.stringifyNumber(t)}},Sme={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 _me.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:OT.stringifyNumber};i_.float=Sme;i_.floatExp=vme;i_.floatNaN=bme});var PT=v(s_=>{"use strict";var BH=cl(),o_=t=>typeof t=="bigint"||Number.isInteger(t),IT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function GH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):BH.stringifyNumber(t)}var wme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>IT(t,2,8,r),stringify:t=>GH(t,8,"0o")},xme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>IT(t,0,10,r),stringify:BH.stringifyNumber},$me={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)=>IT(t,2,16,r),stringify:t=>GH(t,16,"0x")};s_.int=xme;s_.intHex=$me;s_.intOct=wme});var VH=v(ZH=>{"use strict";var kme=sl(),Eme=n_(),Ame=al(),Tme=kf(),Ome=TT(),CT=RT(),DT=PT(),Rme=[kme.map,Ame.seq,Tme.string,Eme.nullTag,Ome.boolTag,DT.intOct,DT.int,DT.intHex,CT.floatNaN,CT.floatExp,CT.float];ZH.schema=Rme});var JH=v(KH=>{"use strict";var Ime=Dt(),Pme=sl(),Cme=al();function WH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Dme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new Ime.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:WH,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})=>WH(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_}],Nme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},jme=[Pme.map,Cme.seq].concat(Dme,Nme);KH.schema=jme});var jT=v(YH=>{"use strict";var Ef=Ge("buffer"),NT=Dt(),Mme=Sf(),Fme={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ef.Buffer=="function")return Ef.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(),MT=Xo(),Lme=Dt(),zme=ts();function XH(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 MT.Pair(new Lme.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())}}IH.stringifyCollection=tme});var es=v(AT=>{"use strict";var ime=kT(),ome=xT(),sme=Ly(),Qo=De(),e_=Xo(),ame=Dt();function $f(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 ET=class extends sme.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=$f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&ame.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=$f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=$f(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!$f(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)ome.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})),ime.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AT.YAMLMap=ET;AT.findPair=$f});var al=v(CH=>{"use strict";var cme=De(),PH=es(),lme={collection:"map",default:!0,nodeClass:PH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return cme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>PH.YAMLMap.from(t,e,r)};CH.map=lme});var ts=v(DH=>{"use strict";var ume=yf(),dme=kT(),fme=Ly(),r_=De(),pme=Dt(),mme=Wo(),TT=class extends fme.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}DH.YAMLSeq=TT});var cl=v(jH=>{"use strict";var hme=De(),NH=ts(),gme={collection:"seq",default:!0,nodeClass:NH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return hme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>NH.YAMLSeq.from(t,e,r)};jH.seq=gme});var kf=v(MH=>{"use strict";var yme=Sf(),_me={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),yme.stringifyString(t,e,r,n)}};MH.string=_me});var n_=v(zH=>{"use strict";var FH=Dt(),LH={identify:t=>t==null,createNode:()=>new FH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new FH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&LH.test.test(t)?t:e.options.nullStr};zH.nullTag=LH});var OT=v(qH=>{"use strict";var bme=Dt(),UH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new bme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&UH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};qH.boolTag=UH});var ll=v(HH=>{"use strict";function vme({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}HH.stringifyNumber=vme});var IT=v(i_=>{"use strict";var Sme=Dt(),RT=ll(),wme={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:RT.stringifyNumber},xme={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():RT.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 Sme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:RT.stringifyNumber};i_.float=$me;i_.floatExp=xme;i_.floatNaN=wme});var CT=v(s_=>{"use strict";var BH=ll(),o_=t=>typeof t=="bigint"||Number.isInteger(t),PT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function GH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):BH.stringifyNumber(t)}var kme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>PT(t,2,8,r),stringify:t=>GH(t,8,"0o")},Eme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>PT(t,0,10,r),stringify:BH.stringifyNumber},Ame={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)=>PT(t,2,16,r),stringify:t=>GH(t,16,"0x")};s_.int=Eme;s_.intHex=Ame;s_.intOct=kme});var VH=v(ZH=>{"use strict";var Tme=al(),Ome=n_(),Rme=cl(),Ime=kf(),Pme=OT(),DT=IT(),NT=CT(),Cme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,Pme.boolTag,NT.intOct,NT.int,NT.intHex,DT.floatNaN,DT.floatExp,DT.float];ZH.schema=Cme});var JH=v(KH=>{"use strict";var Dme=Dt(),Nme=al(),jme=cl();function WH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Mme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new Dme.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:WH,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})=>WH(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_}],Fme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Lme=[Nme.map,jme.seq].concat(Mme,Fme);KH.schema=Lme});var MT=v(YH=>{"use strict";var Ef=Ge("buffer"),jT=Dt(),zme=Sf(),Ume={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ef.Buffer=="function")return Ef.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(),FT=Xo(),qme=Dt(),Hme=ts();function XH(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 FT.Pair(new qme.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]=c_.isPair(n)?n:new MT.Pair(n)}}else e("Expected a sequence for this tag");return t}function QH(t,e,r){let{replacer:n}=r,i=new zme.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(MT.createPair(a,c,r))}return i}var Ume={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:XH,createNode:QH};l_.createPairs=QH;l_.pairs=Ume;l_.resolvePairs=XH});var zT=v(LT=>{"use strict";var e6=De(),FT=Wo(),Af=es(),qme=ts(),t6=u_(),ya=class t extends qme.YAMLSeq{constructor(){super(),this.add=Af.YAMLMap.prototype.add.bind(this),this.delete=Af.YAMLMap.prototype.delete.bind(this),this.get=Af.YAMLMap.prototype.get.bind(this),this.has=Af.YAMLMap.prototype.has.bind(this),this.set=Af.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(e6.isPair(i)?(o=FT.toJS(i.key,"",r),s=FT.toJS(i.value,o,r)):o=FT.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=t6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var Hme={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=t6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)e6.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)};LT.YAMLOMap=ya;LT.omap=Hme});var s6=v(UT=>{"use strict";var r6=Dt();function n6({value:t,source:e},r){return e&&(t?i6:o6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var i6={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 r6.Scalar(!0),stringify:n6},o6={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 r6.Scalar(!1),stringify:n6};UT.falseTag=o6;UT.trueTag=i6});var a6=v(d_=>{"use strict";var Bme=Dt(),qT=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:qT.stringifyNumber},Zme={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():qT.stringifyNumber(t)}},Vme={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 Bme.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:qT.stringifyNumber};d_.float=Vme;d_.floatExp=Zme;d_.floatNaN=Gme});var l6=v(Of=>{"use strict";var c6=cl(),Tf=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 HT(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return c6.stringifyNumber(t)}var Wme={identify:Tf,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=>HT(t,2,"0b")},Kme={identify:Tf,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=>HT(t,8,"0")},Jme={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:c6.stringifyNumber},Yme={identify:Tf,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=>HT(t,16,"0x")};Of.int=Jme;Of.intBin=Wme;Of.intHex=Yme;Of.intOct=Kme});var GT=v(BT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var Xme={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(h_.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}};BT.YAMLSet=_a;BT.set=Xme});var VT=v(g_=>{"use strict";var Qme=cl();function ZT(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 u6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return Qme.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 ehe={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})=>ZT(t,r),stringify:u6},the={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=>ZT(t,!1),stringify:u6},d6={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(d6.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=ZT(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=the;g_.intTime=ehe;g_.timestamp=d6});var m6=v(p6=>{"use strict";var rhe=sl(),nhe=n_(),ihe=al(),ohe=kf(),she=jT(),f6=s6(),WT=a6(),y_=l6(),ahe=Ky(),che=zT(),lhe=u_(),uhe=GT(),KT=VT(),dhe=[rhe.map,ihe.seq,ohe.string,nhe.nullTag,f6.trueTag,f6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,WT.floatNaN,WT.floatExp,WT.float,she.binary,ahe.merge,che.omap,lhe.pairs,uhe.set,KT.intTime,KT.floatTime,KT.timestamp];p6.schema=dhe});var $6=v(XT=>{"use strict";var _6=sl(),fhe=n_(),b6=al(),phe=kf(),mhe=TT(),JT=RT(),YT=PT(),hhe=VH(),ghe=JH(),v6=jT(),Rf=Ky(),S6=zT(),w6=u_(),h6=m6(),x6=GT(),__=VT(),g6=new Map([["core",hhe.schema],["failsafe",[_6.map,b6.seq,phe.string]],["json",ghe.schema],["yaml11",h6.schema],["yaml-1.1",h6.schema]]),y6={binary:v6.binary,bool:mhe.boolTag,float:JT.float,floatExp:JT.floatExp,floatNaN:JT.floatNaN,floatTime:__.floatTime,int:YT.int,intHex:YT.intHex,intOct:YT.intOct,intTime:__.intTime,map:_6.map,merge:Rf.merge,null:fhe.nullTag,omap:S6.omap,pairs:w6.pairs,seq:b6.seq,set:x6.set,timestamp:__.timestamp},yhe={"tag:yaml.org,2002:binary":v6.binary,"tag:yaml.org,2002:merge":Rf.merge,"tag:yaml.org,2002:omap":S6.omap,"tag:yaml.org,2002:pairs":w6.pairs,"tag:yaml.org,2002:set":x6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function _he(t,e,r){let n=g6.get(e);if(n&&!t)return r&&!n.includes(Rf.merge)?n.concat(Rf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(g6.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(Rf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?y6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(y6).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},[])}XT.coreKnownTags=yhe;XT.getTags=_he});var tO=v(k6=>{"use strict";var QT=De(),bhe=sl(),vhe=al(),She=kf(),b_=$6(),whe=(t,e)=>t.keye.key?1:0,eO=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,QT.MAP,{value:bhe.map}),Object.defineProperty(this,QT.SCALAR,{value:She.string}),Object.defineProperty(this,QT.SEQ,{value:vhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?whe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};k6.Schema=eO});var A6=v(E6=>{"use strict";var xhe=De(),rO=wf(),If=_f();function $he(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=rO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(If.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(xhe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(If.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=rO.stringify(t.contents,i,()=>a=null,c);a&&(l+=If.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(rO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +${o.comment}`:n.comment}n=i}t.items[r]=c_.isPair(n)?n:new FT.Pair(n)}}else e("Expected a sequence for this tag");return t}function QH(t,e,r){let{replacer:n}=r,i=new Hme.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(FT.createPair(a,c,r))}return i}var Bme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:XH,createNode:QH};l_.createPairs=QH;l_.pairs=Bme;l_.resolvePairs=XH});var UT=v(zT=>{"use strict";var e6=De(),LT=Wo(),Af=es(),Gme=ts(),t6=u_(),ya=class t extends Gme.YAMLSeq{constructor(){super(),this.add=Af.YAMLMap.prototype.add.bind(this),this.delete=Af.YAMLMap.prototype.delete.bind(this),this.get=Af.YAMLMap.prototype.get.bind(this),this.has=Af.YAMLMap.prototype.has.bind(this),this.set=Af.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(e6.isPair(i)?(o=LT.toJS(i.key,"",r),s=LT.toJS(i.value,o,r)):o=LT.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=t6.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=t6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)e6.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)};zT.YAMLOMap=ya;zT.omap=Zme});var s6=v(qT=>{"use strict";var r6=Dt();function n6({value:t,source:e},r){return e&&(t?i6:o6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var i6={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 r6.Scalar(!0),stringify:n6},o6={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 r6.Scalar(!1),stringify:n6};qT.falseTag=o6;qT.trueTag=i6});var a6=v(d_=>{"use strict";var Vme=Dt(),HT=ll(),Wme={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:HT.stringifyNumber},Kme={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():HT.stringifyNumber(t)}},Jme={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 Vme.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:HT.stringifyNumber};d_.float=Jme;d_.floatExp=Kme;d_.floatNaN=Wme});var l6=v(Of=>{"use strict";var c6=ll(),Tf=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 BT(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return c6.stringifyNumber(t)}var Yme={identify:Tf,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=>BT(t,2,"0b")},Xme={identify:Tf,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=>BT(t,8,"0")},Qme={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:c6.stringifyNumber},ehe={identify:Tf,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=>BT(t,16,"0x")};Of.int=Qme;Of.intBin=Yme;Of.intHex=ehe;Of.intOct=Xme});var ZT=v(GT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var the={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(h_.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}};GT.YAMLSet=_a;GT.set=the});var WT=v(g_=>{"use strict";var rhe=ll();function VT(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 u6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return rhe.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 nhe={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})=>VT(t,r),stringify:u6},ihe={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=>VT(t,!1),stringify:u6},d6={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(d6.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=VT(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=ihe;g_.intTime=nhe;g_.timestamp=d6});var m6=v(p6=>{"use strict";var ohe=al(),she=n_(),ahe=cl(),che=kf(),lhe=MT(),f6=s6(),KT=a6(),y_=l6(),uhe=Ky(),dhe=UT(),fhe=u_(),phe=ZT(),JT=WT(),mhe=[ohe.map,ahe.seq,che.string,she.nullTag,f6.trueTag,f6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,KT.floatNaN,KT.floatExp,KT.float,lhe.binary,uhe.merge,dhe.omap,fhe.pairs,phe.set,JT.intTime,JT.floatTime,JT.timestamp];p6.schema=mhe});var $6=v(QT=>{"use strict";var _6=al(),hhe=n_(),b6=cl(),ghe=kf(),yhe=OT(),YT=IT(),XT=CT(),_he=VH(),bhe=JH(),v6=MT(),Rf=Ky(),S6=UT(),w6=u_(),h6=m6(),x6=ZT(),__=WT(),g6=new Map([["core",_he.schema],["failsafe",[_6.map,b6.seq,ghe.string]],["json",bhe.schema],["yaml11",h6.schema],["yaml-1.1",h6.schema]]),y6={binary:v6.binary,bool:yhe.boolTag,float:YT.float,floatExp:YT.floatExp,floatNaN:YT.floatNaN,floatTime:__.floatTime,int:XT.int,intHex:XT.intHex,intOct:XT.intOct,intTime:__.intTime,map:_6.map,merge:Rf.merge,null:hhe.nullTag,omap:S6.omap,pairs:w6.pairs,seq:b6.seq,set:x6.set,timestamp:__.timestamp},vhe={"tag:yaml.org,2002:binary":v6.binary,"tag:yaml.org,2002:merge":Rf.merge,"tag:yaml.org,2002:omap":S6.omap,"tag:yaml.org,2002:pairs":w6.pairs,"tag:yaml.org,2002:set":x6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function She(t,e,r){let n=g6.get(e);if(n&&!t)return r&&!n.includes(Rf.merge)?n.concat(Rf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(g6.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(Rf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?y6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(y6).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},[])}QT.coreKnownTags=vhe;QT.getTags=She});var rO=v(k6=>{"use strict";var eO=De(),whe=al(),xhe=cl(),$he=kf(),b_=$6(),khe=(t,e)=>t.keye.key?1:0,tO=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,eO.MAP,{value:whe.map}),Object.defineProperty(this,eO.SCALAR,{value:$he.string}),Object.defineProperty(this,eO.SEQ,{value:xhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?khe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};k6.Schema=tO});var A6=v(E6=>{"use strict";var Ehe=De(),nO=wf(),If=_f();function Ahe(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=nO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(If.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ehe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(If.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=nO.stringify(t.contents,i,()=>a=null,c);a&&(l+=If.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(nO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` `)?(r.push("..."),r.push(If.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(If.indentComment(o(c),"")))}return r.join(` `)+` -`}E6.stringifyDocument=$he});var Pf=v(T6=>{"use strict";var khe=gf(),ll=Ly(),Rn=De(),Ehe=Xo(),Ahe=Wo(),The=tO(),Ohe=A6(),nO=Ny(),Rhe=aT(),Ihe=yf(),iO=sT(),oO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 iO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.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=nO.anchorNames(this);e.anchor=!r||n.has(r)?nO.findNewAnchor(r||"a",n):r}return new khe.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}=nO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Ihe.createNode(e,u,m);return a&&Rn.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 Ehe.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 Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ll.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ll.isEmptyPath(e)?this.contents!==void 0:Rn.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 iO.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 iO.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 The.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=Ahe.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"?Rhe.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 Ohe.stringifyDocument(this,e)}};function ul(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=oO});var Nf=v(Df=>{"use strict";var Cf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},sO=class extends Cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},aO=class extends Cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Phe=(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 +`}E6.stringifyDocument=Ahe});var Pf=v(T6=>{"use strict";var The=gf(),ul=Ly(),Rn=De(),Ohe=Xo(),Rhe=Wo(),Ihe=rO(),Phe=A6(),iO=Ny(),Che=cT(),Dhe=yf(),oO=aT(),sO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 oO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.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=iO.anchorNames(this);e.anchor=!r||n.has(r)?iO.findNewAnchor(r||"a",n):r}return new The.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}=iO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Dhe.createNode(e,u,m);return a&&Rn.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 Ohe.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 Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ul.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ul.isEmptyPath(e)?this.contents!==void 0:Rn.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 oO.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 oO.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 Ihe.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=Rhe.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"?Che.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 Phe.stringifyDocument(this,e)}};function dl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=sO});var Nf=v(Df=>{"use strict";var Cf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},aO=class extends Cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cO=class extends Cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Nhe=(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} -`}};Df.YAMLError=Cf;Df.YAMLParseError=sO;Df.YAMLWarning=aO;Df.prettifyError=Phe});var jf=v(O6=>{"use strict";function Che(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}}O6.resolveProps=Che});var v_=v(R6=>{"use strict";function cO(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(cO(e.key)||cO(e.value))return!0}return!1;default:return!0}}R6.containsNewline=cO});var lO=v(I6=>{"use strict";var Dhe=v_();function Nhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Dhe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}I6.flowIndentCheck=Nhe});var uO=v(C6=>{"use strict";var P6=De();function jhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||P6.isScalar(o)&&P6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}C6.mapIncludes=jhe});var L6=v(F6=>{"use strict";var D6=Xo(),Mhe=es(),N6=jf(),Fhe=v_(),j6=lO(),Lhe=uO(),M6="All mapping items must start at the same column";function zhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Mhe.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=N6.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",M6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Fhe.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",M6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&j6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Lhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=N6.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 Uhe=ts(),qhe=jf(),Hhe=lO();function Bhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Uhe.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=qhe.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&&Hhe.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}z6.resolveBlockSeq=Bhe});var dl=v(q6=>{"use strict";function Ghe(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}}q6.resolveEnd=Ghe});var Z6=v(G6=>{"use strict";var Zhe=De(),Vhe=Xo(),H6=es(),Whe=ts(),Khe=dl(),B6=jf(),Jhe=v_(),Yhe=uO(),dO="Block collections are not allowed within flow collections",fO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Xhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?H6.YAMLMap:Whe.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=Khe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}G6.resolveFlowCollection=Xhe});var W6=v(V6=>{"use strict";var Qhe=De(),ege=Dt(),tge=es(),rge=ts(),nge=L6(),ige=U6(),oge=Z6();function pO(t,e,r,n,i,o){let s=r.type==="block-map"?nge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?ige.resolveBlockSeq(t,e,r,n,o):oge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function sge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),pO(t,e,r,i,s)}let l=pO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=Qhe.isNode(u)?u:new ege.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}V6.composeCollection=sge});var hO=v(K6=>{"use strict";var mO=Dt();function age(t,e,r){let n=e.offset,i=cge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?mO.Scalar.BLOCK_FOLDED:mO.Scalar.BLOCK_LITERAL,s=e.source?lge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};Df.YAMLError=Cf;Df.YAMLParseError=aO;Df.YAMLWarning=cO;Df.prettifyError=Nhe});var jf=v(O6=>{"use strict";function jhe(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}}O6.resolveProps=jhe});var v_=v(R6=>{"use strict";function lO(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(lO(e.key)||lO(e.value))return!0}return!1;default:return!0}}R6.containsNewline=lO});var uO=v(I6=>{"use strict";var Mhe=v_();function Fhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Mhe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}I6.flowIndentCheck=Fhe});var dO=v(C6=>{"use strict";var P6=De();function Lhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||P6.isScalar(o)&&P6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}C6.mapIncludes=Lhe});var L6=v(F6=>{"use strict";var D6=Xo(),zhe=es(),N6=jf(),Uhe=v_(),j6=uO(),qhe=dO(),M6="All mapping items must start at the same column";function Hhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??zhe.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=N6.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",M6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Uhe.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",M6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&j6.flowIndentCheck(n.indent,f,i),r.atKey=!1,qhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=N6.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 Bhe=ts(),Ghe=jf(),Zhe=uO();function Vhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Bhe.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=Ghe.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}z6.resolveBlockSeq=Vhe});var fl=v(q6=>{"use strict";function Whe(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}}q6.resolveEnd=Whe});var Z6=v(G6=>{"use strict";var Khe=De(),Jhe=Xo(),H6=es(),Yhe=ts(),Xhe=fl(),B6=jf(),Qhe=v_(),ege=dO(),fO="Block collections are not allowed within flow collections",pO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?H6.YAMLMap:Yhe.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=Xhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}G6.resolveFlowCollection=tge});var W6=v(V6=>{"use strict";var rge=De(),nge=Dt(),ige=es(),oge=ts(),sge=L6(),age=U6(),cge=Z6();function mO(t,e,r,n,i,o){let s=r.type==="block-map"?sge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?age.resolveBlockSeq(t,e,r,n,o):cge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function lge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mO(t,e,r,i,s)}let l=mO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=rge.isNode(u)?u:new nge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}V6.composeCollection=lge});var gO=v(K6=>{"use strict";var hO=Dt();function uge(t,e,r){let n=e.offset,i=dge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hO.Scalar.BLOCK_FOLDED:hO.Scalar.BLOCK_LITERAL,s=e.source?fge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -112,46 +112,46 @@ ${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 cge({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 gO=Dt(),uge=dl();function dge(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=gO.Scalar.PLAIN,c=fge(o,l);break;case"single-quoted-scalar":a=gO.Scalar.QUOTE_SINGLE,c=pge(o,l);break;case"double-quoted-scalar":a=gO.Scalar.QUOTE_DOUBLE,c=mge(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=uge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function fge(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}`),J6(t)}function pge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),J6(t.slice(1,-1)).replace(/''/g,"'")}function J6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var yO=Dt(),pge=fl();function mge(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=yO.Scalar.PLAIN,c=hge(o,l);break;case"single-quoted-scalar":a=yO.Scalar.QUOTE_SINGLE,c=gge(o,l);break;case"double-quoted-scalar":a=yO.Scalar.QUOTE_DOUBLE,c=yge(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=pge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function hge(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}`),J6(t)}function gge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),J6(t.slice(1,-1)).replace(/''/g,"'")}function J6(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function hge(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function _ge(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var gge={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function yge(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Y6.resolveFlowScalar=dge});var eB=v(Q6=>{"use strict";var ba=De(),X6=Dt(),_ge=hO(),bge=yO();function vge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?_ge.resolveBlockScalar(t,e,n):bge.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=Sge(t.schema,i,c,r,n):e.type==="scalar"?l=wge(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 X6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new X6.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 Sge(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 wge({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}Q6.composeScalar=vge});var rB=v(tB=>{"use strict";function xge(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}tB.emptyScalarPosition=xge});var oB=v(bO=>{"use strict";var $ge=gf(),kge=De(),Ege=W6(),nB=eB(),Age=dl(),Tge=rB(),Oge={composeNode:iB,composeEmptyNode:_O};function iB(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=Rge(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=nB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Ege.composeCollection(Oge,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=_O(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&&(!kge.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 _O(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Tge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=nB.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 Rge({options:t},{offset:e,source:r,end:n},i){let o=new $ge.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=Age.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}bO.composeEmptyNode=_O;bO.composeNode=iB});var cB=v(aB=>{"use strict";var Ige=Pf(),sB=oB(),Pge=dl(),Cge=jf();function Dge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Ige.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Cge.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?sB.composeNode(l,i,u,s):sB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Pge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}aB.composeDoc=Dge});var SO=v(dB=>{"use strict";var Nge=Ge("process"),jge=sT(),Mge=Pf(),Mf=Nf(),lB=De(),Fge=cB(),Lge=dl();function Ff(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 uB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ba=De(),X6=Dt(),Sge=gO(),wge=_O();function xge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Sge.resolveBlockScalar(t,e,n):wge.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=kge(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 X6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new X6.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 kge({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}Q6.composeScalar=xge});var rB=v(tB=>{"use strict";function Ege(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}tB.emptyScalarPosition=Ege});var oB=v(vO=>{"use strict";var Age=gf(),Tge=De(),Oge=W6(),nB=eB(),Rge=fl(),Ige=rB(),Pge={composeNode:iB,composeEmptyNode:bO};function iB(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=Cge(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=nB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Oge.composeCollection(Pge,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=bO(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&&(!Tge.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 bO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Ige.emptyScalarPosition(e,r,n),indent:-1,source:""},d=nB.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 Cge({options:t},{offset:e,source:r,end:n},i){let o=new Age.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=Rge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vO.composeEmptyNode=bO;vO.composeNode=iB});var cB=v(aB=>{"use strict";var Dge=Pf(),sB=oB(),Nge=fl(),jge=jf();function Mge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Dge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=jge.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?sB.composeNode(l,i,u,s):sB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Nge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}aB.composeDoc=Mge});var wO=v(dB=>{"use strict";var Fge=Ge("process"),Lge=aT(),zge=Pf(),Mf=Nf(),lB=De(),Uge=cB(),qge=fl();function Ff(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 uB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Ff(r);o?this.warnings.push(new Mf.YAMLWarning(s,n,i)):this.errors.push(new Mf.YAMLParseError(s,n,i))},this.directives=new jge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=uB(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 SO=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(r,n,i,o)=>{let s=Ff(r);o?this.warnings.push(new Mf.YAMLWarning(s,n,i)):this.errors.push(new Mf.YAMLParseError(s,n,i))},this.directives=new Lge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=uB(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(lB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];lB.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=Ff(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Fge.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 Mf.YAMLParseError(Ff(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 Mf.YAMLParseError(Ff(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=Lge.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 Mf.YAMLParseError(Ff(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 Mge.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}}};dB.Composer=vO});var mB=v(S_=>{"use strict";var zge=hO(),Uge=yO(),qge=Nf(),fB=Sf();function Hge(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 qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Uge.resolveFlowScalar(t,e,n);case"block-scalar":return zge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Bge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=fB.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=Ff(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Uge.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 Mf.YAMLParseError(Ff(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 Mf.YAMLParseError(Ff(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=qge.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 Mf.YAMLParseError(Ff(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 zge.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}}};dB.Composer=SO});var mB=v(S_=>{"use strict";var Hge=gO(),Bge=_O(),Gge=Nf(),fB=Sf();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 Gge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bge.resolveFlowScalar(t,e,n);case"block-scalar":return Hge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Vge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=fB.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 pB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Gge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=fB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Zge(t,c);break;case'"':wO(t,c,"double-quoted-scalar");break;case"'":wO(t,c,"single-quoted-scalar");break;default:wO(t,c,"scalar")}}function Zge(t,e){let r=e.indexOf(` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Wge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=fB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Kge(t,c);break;case'"':xO(t,c,"double-quoted-scalar");break;case"'":xO(t,c,"single-quoted-scalar");break;default:xO(t,c,"scalar")}}function Kge(t,e){let r=e.indexOf(` `),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}];pB(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 pB(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 wO(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})}}}S_.createScalarToken=Bge;S_.resolveAsScalar=Hge;S_.setScalarValue=Gge});var gB=v(hB=>{"use strict";var Vge=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}hB.stringify=Vge});var vB=v(bB=>{"use strict";var xO=Symbol("break visit"),Wge=Symbol("skip children"),yB=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),_B(Object.freeze([]),t,e)}va.BREAK=xO;va.SKIP=Wge;va.REMOVE=yB;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 _B(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 $O=mB(),Kge=gB(),Jge=vB(),kO="\uFEFF",EO="",AO="",TO="",Yge=t=>!!t&&"items"in t,Xge=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function Qge(t){switch(t){case kO:return"";case EO:return"";case AO:return"";case TO:return"";default:return JSON.stringify(t)}}function eye(t){switch(t){case kO:return"byte-order-mark";case EO:return"doc-mode";case AO:return"flow-error-end";case TO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`});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 pB(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 xO(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})}}}S_.createScalarToken=Vge;S_.resolveAsScalar=Zge;S_.setScalarValue=Wge});var gB=v(hB=>{"use strict";var Jge=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}hB.stringify=Jge});var vB=v(bB=>{"use strict";var $O=Symbol("break visit"),Yge=Symbol("skip children"),yB=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),_B(Object.freeze([]),t,e)}va.BREAK=$O;va.SKIP=Yge;va.REMOVE=yB;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 _B(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 kO=mB(),Xge=gB(),Qge=vB(),EO="\uFEFF",AO="",TO="",OO="",eye=t=>!!t&&"items"in t,tye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function rye(t){switch(t){case EO:return"";case AO:return"";case TO:return"";case OO:return"";default:return JSON.stringify(t)}}function nye(t){switch(t){case EO:return"byte-order-mark";case AO:return"doc-mode";case TO:return"flow-error-end";case OO: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=$O.createScalarToken;Mr.resolveAsScalar=$O.resolveAsScalar;Mr.setScalarValue=$O.setScalarValue;Mr.stringify=Kge.stringify;Mr.visit=Jge.visit;Mr.BOM=kO;Mr.DOCUMENT=EO;Mr.FLOW_END=AO;Mr.SCALAR=TO;Mr.isCollection=Yge;Mr.isScalar=Xge;Mr.prettyToken=Qge;Mr.tokenType=eye});var IO=v(wB=>{"use strict";var Lf=$_();function Qn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var SB=new Set("0123456789ABCDEFabcdef"),tye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),rye=new Set(` ,[]{} -\r `),OO=t=>!t||rye.has(t),RO=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===` +`: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=kO.createScalarToken;Mr.resolveAsScalar=kO.resolveAsScalar;Mr.setScalarValue=kO.setScalarValue;Mr.stringify=Xge.stringify;Mr.visit=Qge.visit;Mr.BOM=EO;Mr.DOCUMENT=AO;Mr.FLOW_END=TO;Mr.SCALAR=OO;Mr.isCollection=eye;Mr.isScalar=tye;Mr.prettyToken=rye;Mr.tokenType=nye});var PO=v(wB=>{"use strict";var Lf=$_();function Qn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var SB=new Set("0123456789ABCDEFabcdef"),iye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),oye=new Set(` ,[]{} +\r `),RO=t=>!t||oye.has(t),IO=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(OO),"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(RO),"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===` @@ -161,38 +161,38 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `&&o>=this.pos&&o+1+r>a)e=o;else break}while(!0);return yield Lf.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&&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 Lf.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(OO),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(tye.has(r))r=this.buffer[++e];else if(r==="%"&&SB.has(this.buffer[e+1])&&SB.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===` +`){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 Lf.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(RO),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(iye.has(r))r=this.buffer[++e];else if(r==="%"&&SB.has(this.buffer[e+1])&&SB.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)}};wB.Lexer=RO});var CO=v(xB=>{"use strict";var PO=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 nye=Ge("process"),$B=$_(),iye=IO();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"&&EB(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&&kB(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)}};wB.Lexer=IO});var DO=v(xB=>{"use strict";var CO=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 sye=Ge("process"),$B=$_(),aye=PO();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"&&EB(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&&kB(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(AB(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)){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=fl(i);EB(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(AB(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);EB(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=E_(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=E_(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())}}};TB.Parser=DO});var CB=v(Uf=>{"use strict";var OB=SO(),oye=Pf(),zf=Nf(),sye=bT(),aye=De(),cye=CO(),RB=NO();function IB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new cye.LineCounter||null,prettyErrors:e}}function lye(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(zf.prettifyError(t,r)),a.warnings.forEach(zf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function PB(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.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 zf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(zf.prettifyError(t,r)),s.warnings.forEach(zf.prettifyError(t,r))),s}function uye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=PB(t,r);if(!i)return null;if(i.warnings.forEach(o=>sye.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 dye(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 aye.isDocument(t)&&!n?t.toString(r):new oye.Document(t,n,r).toString(r)}Uf.parse=uye;Uf.parseAllDocuments=lye;Uf.parseDocument=PB;Uf.stringify=dye});var tr=v(Ze=>{"use strict";var fye=SO(),pye=Pf(),mye=tO(),jO=Nf(),hye=gf(),ns=De(),gye=Xo(),yye=Dt(),_ye=es(),bye=ts(),vye=$_(),Sye=IO(),wye=CO(),xye=NO(),T_=CB(),DB=ff();Ze.Composer=fye.Composer;Ze.Document=pye.Document;Ze.Schema=mye.Schema;Ze.YAMLError=jO.YAMLError;Ze.YAMLParseError=jO.YAMLParseError;Ze.YAMLWarning=jO.YAMLWarning;Ze.Alias=hye.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=gye.Pair;Ze.Scalar=yye.Scalar;Ze.YAMLMap=_ye.YAMLMap;Ze.YAMLSeq=bye.YAMLSeq;Ze.CST=vye;Ze.Lexer=Sye.Lexer;Ze.LineCounter=wye.LineCounter;Ze.Parser=xye.Parser;Ze.parse=T_.parse;Ze.parseAllDocuments=T_.parseAllDocuments;Ze.parseDocument=T_.parseDocument;Ze.stringify=T_.stringify;Ze.visit=DB.visit;Ze.visitAsync=DB.visitAsync});import{execFileSync as MO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as $ye}from"node:path";function kye(t){try{let e=MO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?$ye(t,e):null}catch{return null}}function FO(t){let e=kye(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 Sa(t){return FO(t)!==null}function qf(t,e){try{let r=MO("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 qf(t,e)!==null}function NB(t,e){try{let r=MO("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 Eye}from"node:child_process";import{existsSync as Aye,readFileSync as Tye}from"node:fs";import{join as MB}from"node:path";function hl(t,e){return Eye("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){FB(t,e);let r=hl(t,["rev-parse","HEAD"]).trim(),n=Oye(t,e);return{groups:Rye(t,n),head:r,inventory:{after:jB(C_(t,"spec.yaml")),before:jB(Hf(t,e,"spec.yaml"))},since:e,unsharded_commits:Dye(t,e)}}function LO(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 FB(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 Oye(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(!(!P_(c)&&!P_(a)))if(s.startsWith("A")){let l=ml(C_(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(Hf(t,e,a));l&&n.push(pl(l,"archived"))}else{let l=ml(C_(t,c));if(!l)continue;let d=ml(Hf(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 P_(t){return t.startsWith("spec/features/")&&(t.endsWith(".yaml")||t.endsWith(".yml"))}function LB(t,e){FB(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(!P_(c)&&!P_(a))continue;let l=s.startsWith("A"),u=s.startsWith("D"),d=l||!u?ml(Hf(t,"HEAD",c)):null,f=l?null:ml(Hf(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=>LO(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,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=MB(t,e);if(!Aye(r))return null;try{return Tye(r,"utf8")}catch{return null}}function Hf(t,e,r){try{return hl(t,["show",`${e}:${r}`])}catch{return null}}function Rye(t,e){let r=Iye(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 Iye(t){let e=C_(t,MB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function jB(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 Dye(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);Pye.test(a)&&(Cye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Pye,Cye,gl=y(()=>{"use strict";D_=wt(tr(),1);wa();Pye=/^(feat|fix)(\([^)]*\))?!?:/,Cye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as zB}from"node:child_process";import{appendFileSync as Nye,existsSync as zO,mkdirSync as jye,readFileSync as Mye,renameSync as Fye,statSync as Lye}from"node:fs";import{userInfo as zye}from"node:os";import{dirname as Uye,join as qO}from"node:path";function HO(t){return qO(t,UB,qye)}function rn(t,e){let r=HO(t),n=Uye(r);zO(n)||jye(n,{recursive:!0});try{zO(r)&&Lye(r).size>Hye&&Fye(r,qO(n,qB))}catch{}Nye(r,`${JSON.stringify(e)} -`,"utf8")}function UO(t){if(!zO(t))return[];let e=Mye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return UO(HO(t))}function N_(t){return[...UO(qO(t,UB,qB)),...UO(HO(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 Bye(t){let e;try{e=zB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=zye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Gye(t){try{return zB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Bf(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=Gye(t),i=Bye(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 UB,qye,qB,Hye,Fr=y(()=>{"use strict";UB=".cladding",qye="events.log.jsonl",qB="events.log.1.jsonl",Hye=5*1024*1024});import{execFileSync as Zye}from"node:child_process";import{existsSync as HB,readdirSync as Vye,readFileSync as Wye,statSync as BB}from"node:fs";import{createHash as Kye}from"node:crypto";import{join as BO}from"node:path";function xa(t){try{return Zye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function GO(t){let e=[],r=BO(t,"spec.yaml");HB(r)&&BB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=BO(t,"spec",i);if(!(!HB(o)||!BB(o).isDirectory()))for(let s of Vye(o))s.endsWith(".yaml")&&e.push(BO(o,s))}e.sort();let n=Kye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Wye(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:GO(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 Gf=y(()=>{"use strict";Fr()});import{readFileSync as Jye,statSync as Yye}from"node:fs";import{extname as Xye,resolve as ZO,sep as Qye}from"node:path";function on(t){return Math.ceil(t.length/4)}function r_e(t,e){let r=ZO(e),n=ZO(r,t);return n===r||n.startsWith(r+Qye)}function ZB(t,e,r,n){if(!r_e(t,e))return{path:t,omitted:"unsafe-path"};if(!e_e.has(Xye(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>GB)return{path:t,omitted:"too-large",bytes:o}}else{let l=ZO(e,t);try{o=Yye(l).size}catch{return{path:t,omitted:"missing"}}if(o>GB)return{path:t,omitted:"too-large",bytes:o};try{i=Jye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(t_e))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=` +`,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())}}};TB.Parser=NO});var CB=v(Uf=>{"use strict";var OB=wO(),cye=Pf(),zf=Nf(),lye=vT(),uye=De(),dye=DO(),RB=jO();function IB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new dye.LineCounter||null,prettyErrors:e}}function fye(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(zf.prettifyError(t,r)),a.warnings.forEach(zf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function PB(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.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 zf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(zf.prettifyError(t,r)),s.warnings.forEach(zf.prettifyError(t,r))),s}function pye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=PB(t,r);if(!i)return null;if(i.warnings.forEach(o=>lye.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 mye(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 uye.isDocument(t)&&!n?t.toString(r):new cye.Document(t,n,r).toString(r)}Uf.parse=pye;Uf.parseAllDocuments=fye;Uf.parseDocument=PB;Uf.stringify=mye});var tr=v(Ze=>{"use strict";var hye=wO(),gye=Pf(),yye=rO(),MO=Nf(),_ye=gf(),ns=De(),bye=Xo(),vye=Dt(),Sye=es(),wye=ts(),xye=$_(),$ye=PO(),kye=DO(),Eye=jO(),T_=CB(),DB=ff();Ze.Composer=hye.Composer;Ze.Document=gye.Document;Ze.Schema=yye.Schema;Ze.YAMLError=MO.YAMLError;Ze.YAMLParseError=MO.YAMLParseError;Ze.YAMLWarning=MO.YAMLWarning;Ze.Alias=_ye.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=bye.Pair;Ze.Scalar=vye.Scalar;Ze.YAMLMap=Sye.YAMLMap;Ze.YAMLSeq=wye.YAMLSeq;Ze.CST=xye;Ze.Lexer=$ye.Lexer;Ze.LineCounter=kye.LineCounter;Ze.Parser=Eye.Parser;Ze.parse=T_.parse;Ze.parseAllDocuments=T_.parseAllDocuments;Ze.parseDocument=T_.parseDocument;Ze.stringify=T_.stringify;Ze.visit=DB.visit;Ze.visitAsync=DB.visitAsync});import{execFileSync as FO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as Aye}from"node:path";function Tye(t){try{let e=FO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Aye(t,e):null}catch{return null}}function LO(t){let e=Tye(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 Sa(t){return LO(t)!==null}function qf(t,e){try{let r=FO("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 qf(t,e)!==null}function NB(t,e){try{let r=FO("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 Oye}from"node:child_process";import{existsSync as Rye,readFileSync as Iye}from"node:fs";import{join as MB}from"node:path";function gl(t,e){return Oye("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){FB(t,e);let r=gl(t,["rev-parse","HEAD"]).trim(),n=Pye(t,e);return{groups:Cye(t,n),head:r,inventory:{after:jB(C_(t,"spec.yaml")),before:jB(Hf(t,e,"spec.yaml"))},since:e,unsharded_commits:Mye(t,e)}}function zO(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 FB(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 Pye(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(Hf(t,e,a));l&&n.push(ml(l,"archived"))}else{let l=hl(C_(t,c));if(!l)continue;let d=hl(Hf(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 LB(t,e){FB(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(Hf(t,"HEAD",c)):null,f=l?null:hl(Hf(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=>zO(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=MB(t,e);if(!Rye(r))return null;try{return Iye(r,"utf8")}catch{return null}}function Hf(t,e,r){try{return gl(t,["show",`${e}:${r}`])}catch{return null}}function Cye(t,e){let r=Dye(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 Dye(t){let e=C_(t,MB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function jB(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 Mye(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);Nye.test(a)&&(jye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Nye,jye,yl=y(()=>{"use strict";D_=wt(tr(),1);wa();Nye=/^(feat|fix)(\([^)]*\))?!?:/,jye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as zB}from"node:child_process";import{appendFileSync as Fye,existsSync as UO,mkdirSync as Lye,readFileSync as zye,renameSync as Uye,statSync as qye}from"node:fs";import{userInfo as Hye}from"node:os";import{dirname as Bye,join as HO}from"node:path";function BO(t){return HO(t,UB,Gye)}function rn(t,e){let r=BO(t),n=Bye(r);UO(n)||Lye(n,{recursive:!0});try{UO(r)&&qye(r).size>Zye&&Uye(r,HO(n,qB))}catch{}Fye(r,`${JSON.stringify(e)} +`,"utf8")}function qO(t){if(!UO(t))return[];let e=zye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return qO(BO(t))}function N_(t){return[...qO(HO(t,UB,qB)),...qO(BO(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 Vye(t){let e;try{e=zB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Hye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Wye(t){try{return zB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Bf(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=Wye(t),i=Vye(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 UB,Gye,qB,Zye,Fr=y(()=>{"use strict";UB=".cladding",Gye="events.log.jsonl",qB="events.log.1.jsonl",Zye=5*1024*1024});import{execFileSync as Kye}from"node:child_process";import{existsSync as HB,readdirSync as Jye,readFileSync as Yye,statSync as BB}from"node:fs";import{createHash as Xye}from"node:crypto";import{join as GO}from"node:path";function xa(t){try{return Kye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function ZO(t){let e=[],r=GO(t,"spec.yaml");HB(r)&&BB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=GO(t,"spec",i);if(!(!HB(o)||!BB(o).isDirectory()))for(let s of Jye(o))s.endsWith(".yaml")&&e.push(GO(o,s))}e.sort();let n=Xye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Yye(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:ZO(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 Gf=y(()=>{"use strict";Fr()});import{readFileSync as Qye,statSync as e_e}from"node:fs";import{extname as t_e,resolve as VO,sep as r_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function o_e(t,e){let r=VO(e),n=VO(r,t);return n===r||n.startsWith(r+r_e)}function ZB(t,e,r,n){if(!o_e(t,e))return{path:t,omitted:"unsafe-path"};if(!n_e.has(t_e(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>GB)return{path:t,omitted:"too-large",bytes:o}}else{let l=VO(e,t);try{o=e_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>GB)return{path:t,omitted:"too-large",bytes:o};try{i=Qye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(i_e))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 e_e,GB,t_e,L_=y(()=>{"use strict";e_e=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"]),GB=2e6,t_e="\0"});function Zf(t){for(let i of n_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 VO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function i_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??[])VO(e,s,o);for(let s of i.modules??[])VO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Zf(a);c&&VO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=VB.get(t);return e||(e=i_e(t),VB.set(t,e)),e}var n_e,VB,as=y(()=>{"use strict";n_e=["derived:","fixture:","script:","self-dogfood:"];VB=new WeakMap});function WO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=o_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=WO(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:KO(i)}}var $a=y(()=>{"use strict";as()});function WB(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=In(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=WO(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=WB(_),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_,JO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function s_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 KB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=s_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 JB=y(()=>{"use strict"});function a_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=a_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=KB(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";JB()});import{existsSync as XB,readdirSync as c_e,readFileSync as l_e}from"node:fs";import{join as XO}from"node:path";function QO(t,e=d_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function f_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:QO(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:QO(`done reverted \u2014 pre-push strict gate red${r}`)}}function YB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function p_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 QO(n)}function m_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)=>YB(m)-YB(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(-u_e).map(f_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?p_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 YO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function h_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 g_e(t,e,r){let n=YO(t,/_Rolled back at_\s*`([^`]+)`/),i=YO(t,/Last failed gate:\s*`([^`]+)`/),o=YO(t,/Retry attempts:\s*(\d+)/),s=h_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function y_e(t,e){let r=XO(t,".cladding","post-mortems");if(!XB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of c_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(g_e(l_e(XO(r,o),"utf8"),e,o))}catch{}return i}function QB(t,e){try{let r=N_(t),n=y_e(t,e),i=XB(XO(t,".cladding","events.log.1.jsonl"));return m_e(r,n,e,{truncated:i})}catch{return}}var u_e,d_e,eG=y(()=>{"use strict";Fr();u_e=5,d_e=120});function H_(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:__e,o=e,s,a=In(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=QB(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>b_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 __e,b_e,B_=y(()=>{"use strict";L_();q_();JO();eG();$a();as();__e=3e3,b_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 v_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 tG(t,e,r="."){let n=In(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=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:v_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,G_=y(()=>{"use strict";L_();JO();B_();as();_l="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as S_e,existsSync as eR,mkdirSync as w_e,readFileSync as rG}from"node:fs";import{dirname as x_e,join as $_e}from"node:path";function tR(t){return $_e(t,k_e,E_e)}function A_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:GO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function nG(t,e){try{let r=A_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=rR(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=tR(t),s=x_e(o);return eR(s)||w_e(s,{recursive:!0}),S_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 n_e,GB,i_e,L_=y(()=>{"use strict";n_e=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"]),GB=2e6,i_e="\0"});function Zf(t){for(let i of s_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 WO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function a_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??[])WO(e,s,o);for(let s of i.modules??[])WO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Zf(a);c&&WO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=VB.get(t);return e||(e=a_e(t),VB.set(t,e)),e}var s_e,VB,as=y(()=>{"use strict";s_e=["derived:","fixture:","script:","self-dogfood:"];VB=new WeakMap});function KO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=c_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=KO(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:JO(i)}}var $a=y(()=>{"use strict";as()});function WB(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=In(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=KO(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=WB(_),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_,YO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function l_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 KB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=l_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 JB=y(()=>{"use strict"});function u_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=u_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=KB(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";JB()});import{existsSync as XB,readdirSync as d_e,readFileSync as f_e}from"node:fs";import{join as QO}from"node:path";function eR(t,e=m_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function h_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:eR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:eR(`done reverted \u2014 pre-push strict gate red${r}`)}}function YB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function g_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 eR(n)}function y_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)=>YB(m)-YB(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(-p_e).map(h_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?g_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 XO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function __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 b_e(t,e,r){let n=XO(t,/_Rolled back at_\s*`([^`]+)`/),i=XO(t,/Last failed gate:\s*`([^`]+)`/),o=XO(t,/Retry attempts:\s*(\d+)/),s=__e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function v_e(t,e){let r=QO(t,".cladding","post-mortems");if(!XB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of d_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(b_e(f_e(QO(r,o),"utf8"),e,o))}catch{}return i}function QB(t,e){try{let r=N_(t),n=v_e(t,e),i=XB(QO(t,".cladding","events.log.1.jsonl"));return y_e(r,n,e,{truncated:i})}catch{return}}var p_e,m_e,eG=y(()=>{"use strict";Fr();p_e=5,m_e=120});function H_(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:S_e,o=e,s,a=In(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=QB(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>w_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 S_e,w_e,B_=y(()=>{"use strict";L_();q_();YO();eG();$a();as();S_e=3e3,w_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 x_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 tG(t,e,r="."){let n=In(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=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:x_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_();YO();B_();as();bl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as $_e,existsSync as tR,mkdirSync as k_e,readFileSync as rG}from"node:fs";import{dirname as E_e,join as A_e}from"node:path";function rR(t){return A_e(t,T_e,O_e)}function R_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:ZO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function nG(t,e){try{let r=R_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=nR(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=rR(t),s=E_e(o);return tR(s)||k_e(s,{recursive:!0}),$_e(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function iG(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 rR(t,e){let r=tR(t);if(!eR(r))return[];let n;try{n=rG(r,"utf8")}catch{return[]}let i=iG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function oG(t){let e=tR(t);if(!eR(e))return{snapshots:[],unreadable:!1};let r;try{r=rG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=iG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Vf(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 sG(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?` (${Vf(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 k_e,E_e,Wf=y(()=>{"use strict";Gf();G_();k_e=".cladding",E_e="measure.jsonl"});import{existsSync as T_e}from"node:fs";import{join as O_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}** (${R_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 nR(t,e){let r=rR(t);if(!tR(r))return[];let n;try{n=rG(r,"utf8")}catch{return[]}let i=iG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function oG(t){let e=rR(t);if(!tR(e))return{snapshots:[],unreadable:!1};let r;try{r=rG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=iG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Vf(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 sG(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?` (${Vf(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 T_e,O_e,Wf=y(()=>{"use strict";Gf();G_();T_e=".cladding",O_e="measure.jsonl"});import{existsSync as I_e}from"node:fs";import{join as P_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}** (${C_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 cG(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 ${Vf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Vf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Vf(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"} | ${P_e(l,r)} |`)}return n.join(` -`)}function P_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 I_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${T_e(O_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),aG(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)aG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function aG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=LO(r);n&&t.push(`- ${n}`)}t.push("")}var R_e,I_e,Z_=y(()=>{"use strict";Wf();G_();gl();R_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};I_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 C_e}from"node:fs";function Ri(t="./spec.yaml"){let e=C_e(t,"utf8");return(0,lG.parse)(e)}var lG,V_=y(()=>{"use strict";lG=wt(tr(),1)});var cs=v((Lr,sR)=>{"use strict";var nR=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+dG(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()};nR.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 nR(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 nR(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};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 D_e(t,e){return e+": "+t.toString()+` -`}W_.prototype.toString=function(e){return this.errors.map(D_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});sR.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 uG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};uG.prototype=Object.create(Error.prototype,{constructor:{value:uG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var iR=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+dG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};iR.prototype.resolve=function(e){return fG(this.base,e)};iR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=fG(this.base,i||"");var s=new iR(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 dG=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 N_e(t,e,r,n){typeof r=="object"?e[n]=oR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function j_e(t,e,r){e[r]=t[r]}function M_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=oR(t[n],e[n]):r[n]=e[n]}function oR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(N_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(j_e.bind(null,t,n)),Object.keys(e).forEach(M_e.bind(null,t,e,n))),n}sR.exports.deepMerge=oR;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 F_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(F_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 fG=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 gG=v((QQe,hG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,aR={};aR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=aR.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 cR(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(cR.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(cR.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=cR.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 lR(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(lR(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=lR(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 pG(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&&pG.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)pG.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 L_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var uR=cs();dR.exports.SchemaScanResult=yG;function yG(t,e){this.id=t,this.ref=e}dR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=uR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=uR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!uR.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 _G=gG(),us=cs(),bG=K_().scan,vG=us.ValidatorResult,z_e=us.ValidatorResultError,Kf=us.SchemaError,SG=us.SchemaContext,U_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(_G.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=bG(r||U_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 Kf("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 Kf('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)};xG.exports=Yt});var kG=v((ret,yo)=>{"use strict";var q_e=yo.exports.Validator=$G();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 q_e;return n.validate(t,e,r)}});import{readFileSync as H_e}from"node:fs";import{dirname as B_e,join as G_e}from"node:path";import{fileURLToPath as Z_e}from"node:url";function Y_e(t){let e=J_e.validate(t,K_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function AG(t){let e=Y_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 ${Vf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Vf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Vf(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"} | ${N_e(l,r)} |`)}return n.join(` +`)}function N_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 D_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${I_e(P_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),aG(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)aG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function aG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zO(r);n&&t.push(`- ${n}`)}t.push("")}var C_e,D_e,Z_=y(()=>{"use strict";Wf();G_();yl();C_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};D_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 j_e}from"node:fs";function Ri(t="./spec.yaml"){let e=j_e(t,"utf8");return(0,lG.parse)(e)}var lG,V_=y(()=>{"use strict";lG=wt(tr(),1)});var cs=v((Lr,aR)=>{"use strict";var iR=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+dG(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()};iR.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 iR(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 iR(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};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 M_e(t,e){return e+": "+t.toString()+` +`}W_.prototype.toString=function(e){return this.errors.map(M_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});aR.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 uG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};uG.prototype=Object.create(Error.prototype,{constructor:{value:uG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var oR=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+dG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};oR.prototype.resolve=function(e){return fG(this.base,e)};oR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=fG(this.base,i||"");var s=new oR(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 dG=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 F_e(t,e,r,n){typeof r=="object"?e[n]=sR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function L_e(t,e,r){e[r]=t[r]}function z_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=sR(t[n],e[n]):r[n]=e[n]}function sR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(F_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(L_e.bind(null,t,n)),Object.keys(e).forEach(z_e.bind(null,t,e,n))),n}aR.exports.deepMerge=sR;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 U_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(U_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 fG=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 gG=v((iet,hG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,cR={};cR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=cR.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 lR(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(lR.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(lR.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=lR.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 uR(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(uR(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=uR(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 pG(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&&pG.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)pG.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 q_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var dR=cs();fR.exports.SchemaScanResult=yG;function yG(t,e){this.id=t,this.ref=e}fR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=dR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=dR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!dR.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 _G=gG(),us=cs(),bG=K_().scan,vG=us.ValidatorResult,H_e=us.ValidatorResultError,Kf=us.SchemaError,SG=us.SchemaContext,B_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(_G.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=bG(r||B_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 Kf("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 Kf('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)};xG.exports=Yt});var kG=v((aet,yo)=>{"use strict";var G_e=yo.exports.Validator=$G();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 G_e;return n.validate(t,e,r)}});import{readFileSync as Z_e}from"node:fs";import{dirname as V_e,join as W_e}from"node:path";import{fileURLToPath as K_e}from"node:url";function ebe(t){let e=Q_e.validate(t,X_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function AG(t){let e=ebe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var EG,V_e,W_e,K_e,J_e,TG=y(()=>{"use strict";EG=wt(kG(),1),V_e=B_e(Z_e(import.meta.url)),W_e=G_e(V_e,"schema.json"),K_e=JSON.parse(H_e(W_e,"utf8")),J_e=new EG.Validator});import{existsSync as fR,readdirSync as X_e}from"node:fs";import{dirname as Q_e,join as Aa,resolve as RG}from"node:path";function OG(t){return fR(t)?X_e(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:RG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&RG(t)===J_.cwd?J_.spec:ebe(t,e)}function ebe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,Q_e(e),"spec");if(!n.features||n.features.length===0){let o=OG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=OG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");fR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(fR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return AG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import wl from"node:process";function hR(){return!!wl.stdout.isTTY}function L(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";hR()?wl.stdout.write(`${pR[t]}${n}${mR} ${e}${i} -`):wl.stdout.write(`${n} ${e}${i} -`)}function Jf(t,e,r=""){if(!hR())return;let n=r?` ${r}`:"";wl.stdout.write(`${PG}${pR.start}\xB7${mR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";hR()?wl.stdout.write(`${PG}${pR[t]}${n}${mR} ${e}${i} -`):wl.stdout.write(`${n} ${e}${i} -`)}var IG,pR,mR,PG,Pi=y(()=>{"use strict";IG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},pR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},mR="\x1B[0m",PG="\r\x1B[K"});import{createHash as _R}from"node:crypto";import{existsSync as Fbe,readFileSync as bR,writeFileSync as Lbe}from"node:fs";import{join as Y_}from"node:path";function iZ(t){let e=_R("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} -`)}),e.digest("hex")}function zbe(t,e){let r=_R("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(bR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oZ(t,e){let r=_R("sha256");try{r.update(bR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...nZ);if(!Fbe(e))return null;let r;try{r=bR(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)!==oZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===zbe(e,n)?{state:"fresh"}:{state:"stale"}}function sZ(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}: ${oZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Ube+(r?`policy: + `)}`)}var EG,J_e,Y_e,X_e,Q_e,TG=y(()=>{"use strict";EG=wt(kG(),1),J_e=V_e(K_e(import.meta.url)),Y_e=W_e(J_e,"schema.json"),X_e=JSON.parse(Z_e(Y_e,"utf8")),Q_e=new EG.Validator});import{existsSync as pR,readdirSync as tbe}from"node:fs";import{dirname as rbe,join as Aa,resolve as RG}from"node:path";function OG(t){return pR(t)?tbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:RG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&RG(t)===J_.cwd?J_.spec:nbe(t,e)}function nbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,rbe(e),"spec");if(!n.features||n.features.length===0){let o=OG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=OG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");pR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(pR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return AG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import xl from"node:process";function gR(){return!!xl.stdout.isTTY}function L(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";gR()?xl.stdout.write(`${mR[t]}${n}${hR} ${e}${i} +`):xl.stdout.write(`${n} ${e}${i} +`)}function Jf(t,e,r=""){if(!gR())return;let n=r?` ${r}`:"";xl.stdout.write(`${PG}${mR.start}\xB7${hR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";gR()?xl.stdout.write(`${PG}${mR[t]}${n}${hR} ${e}${i} +`):xl.stdout.write(`${n} ${e}${i} +`)}var IG,mR,hR,PG,Pi=y(()=>{"use strict";IG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},mR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},hR="\x1B[0m",PG="\r\x1B[K"});import{createHash as bR}from"node:crypto";import{existsSync as Ube,readFileSync as vR,writeFileSync as qbe}from"node:fs";import{join as Y_}from"node:path";function iZ(t){let e=bR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function Hbe(t,e){let r=bR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(vR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oZ(t,e){let r=bR("sha256");try{r.update(vR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...nZ);if(!Ube(e))return null;let r;try{r=vR(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)!==oZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Hbe(e,n)?{state:"fresh"}:{state:"stale"}}function sZ(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}: ${oZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Bbe+(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 Lbe(Y_(t,...nZ),a,"utf8"),!0}var nZ,Ube,$l=y(()=>{"use strict";nZ=["spec","attestation.yaml"];Ube=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return qbe(Y_(t,...nZ),a,"utf8"),!0}var nZ,Bbe,kl=y(()=>{"use strict";nZ=["spec","attestation.yaml"];Bbe=`# 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 vR}from"node:path";function eb(t){fs={cwd:vR(t),results:new Map}}function aZ(t,e,r){!fs||fs.cwd!==vR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==vR(e)?null:fs.results.get(t)??null}function rb(){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 qbe}from"node:url";var El,Hbe,SR,wR,Al=y(()=>{El=(t,e)=>{let r=wR(Hbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Hbe=t=>SR(t)?t.toString():t,SR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,wR=t=>t instanceof URL?qbe(t):t});var nb,xR=y(()=>{bo();Al();nb=(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 Bbe}from"node:string_decoder";var cZ,lZ,qt,vo,Gbe,uZ,Zbe,ib,dZ,Vbe,Xf,Wbe,$R,Kbe,an=y(()=>{({toString:cZ}=Object.prototype),lZ=t=>cZ.call(t)==="[object ArrayBuffer]",qt=t=>cZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gbe=new TextEncoder,uZ=t=>Gbe.encode(t),Zbe=new TextDecoder,ib=t=>Zbe.decode(t),dZ=(t,e)=>Vbe(t,e).join(""),Vbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Bbe(e),n=t.map(o=>typeof o=="string"?uZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Xf=t=>t.length===1&&qt(t[0])?t[0]:$R(Wbe(t)),Wbe=t=>t.map(e=>typeof e=="string"?uZ(e):e),$R=t=>{let e=new Uint8Array(Kbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Kbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Jbe}from"node:child_process";var hZ,gZ,Ybe,Xbe,fZ,Qbe,pZ,mZ,eve,yZ=y(()=>{bo();an();hZ=t=>Array.isArray(t)&&Array.isArray(t.raw),gZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=Ybe({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,{}]},Ybe=({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}=Xbe(i,t.raw[n]),c=pZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mZ(d)):[mZ(l)];return pZ(c,u,a)},Xbe=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fZ.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)],mZ=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 eve(t);throw t instanceof Jbe||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`)},eve=({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 kR from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[kR.stdin,kR.stdout,kR.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as tve}from"node:util";var bZ,ER,rve,nve,ive,ove,_Z,sve,AR,ave,cve,lve,uve,TR,wo,xo=y(()=>{bo();So();bZ=t=>{let e={...t};for(let r of TR)e[r]=ER(t,r);return e},ER=(t,e)=>{let r=Array.from({length:rve(t)+1}),n=nve(t[e],r,e);return cve(n,e)},rve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,nve=(t,e,r)=>Ot(t)?ive(t,e,r):e.fill(t),ive=(t,e,r)=>{for(let n of Object.keys(t).sort(ove))for(let i of sve(n,r,e))e[i]=t[n];return e},ove=(t,e)=>_Z(t)<_Z(e)?1:-1,_Z=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,sve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=AR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as SR}from"node:path";function eb(t){fs={cwd:SR(t),results:new Map}}function aZ(t,e,r){!fs||fs.cwd!==SR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==SR(e)?null:fs.results.get(t)??null}function rb(){fs=null}var fs,El=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 Gbe}from"node:url";var Al,Zbe,wR,xR,Tl=y(()=>{Al=(t,e)=>{let r=xR(Zbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Zbe=t=>wR(t)?t.toString():t,wR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,xR=t=>t instanceof URL?Gbe(t):t});var nb,$R=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 Vbe}from"node:string_decoder";var cZ,lZ,qt,vo,Wbe,uZ,Kbe,ib,dZ,Jbe,Xf,Ybe,kR,Xbe,an=y(()=>{({toString:cZ}=Object.prototype),lZ=t=>cZ.call(t)==="[object ArrayBuffer]",qt=t=>cZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Wbe=new TextEncoder,uZ=t=>Wbe.encode(t),Kbe=new TextDecoder,ib=t=>Kbe.decode(t),dZ=(t,e)=>Jbe(t,e).join(""),Jbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Vbe(e),n=t.map(o=>typeof o=="string"?uZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Xf=t=>t.length===1&&qt(t[0])?t[0]:kR(Ybe(t)),Ybe=t=>t.map(e=>typeof e=="string"?uZ(e):e),kR=t=>{let e=new Uint8Array(Xbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Xbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Qbe}from"node:child_process";var hZ,gZ,eve,tve,fZ,rve,pZ,mZ,nve,yZ=y(()=>{bo();an();hZ=t=>Array.isArray(t)&&Array.isArray(t.raw),gZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=eve({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,{}]},eve=({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}=tve(i,t.raw[n]),c=pZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mZ(d)):[mZ(l)];return pZ(c,u,a)},tve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fZ.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)],mZ=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 nve(t);throw t instanceof Qbe||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`)},nve=({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 ER from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[ER.stdin,ER.stdout,ER.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as ive}from"node:util";var bZ,AR,ove,sve,ave,cve,_Z,lve,TR,uve,dve,fve,pve,OR,wo,xo=y(()=>{bo();So();bZ=t=>{let e={...t};for(let r of OR)e[r]=AR(t,r);return e},AR=(t,e)=>{let r=Array.from({length:ove(t)+1}),n=sve(t[e],r,e);return dve(n,e)},ove=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,sve=(t,e,r)=>Ot(t)?ave(t,e,r):e.fill(t),ave=(t,e,r)=>{for(let n of Object.keys(t).sort(cve))for(let i of lve(n,r,e))e[i]=t[n];return e},cve=(t,e)=>_Z(t)<_Z(e)?1:-1,_Z=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,lve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(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]},AR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=ave.exec(t);if(e!==null)return Number(e[1])},ave=/^fd(\d+)$/,cve=(t,e)=>t.map(r=>r===void 0?uve[e]:r),lve=tve("execa").enabled?"full":"none",uve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:lve,stripFinalNewline:!0},TR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Tl,Ol,vZ,OR,dve,ab,cb,ps=y(()=>{xo();Tl=({verbose:t},e)=>OR(t,e)!=="none",Ol=({verbose:t},e)=>!["none","short"].includes(OR(t,e)),vZ=({verbose:t},e)=>{let r=OR(t,e);return ab(r)?r:void 0},OR=(t,e)=>e===void 0?dve(t):wo(t,e),dve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as fve}from"node:process";import{stripVTControlCharacters as pve}from"node:util";var SZ,Qf,wZ,mve,hve,gve,yve,_ve,bve,vve,lb=y(()=>{SZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>bve(wZ(o))).join(" ");return{command:n,escapedCommand:i}},Qf=t=>pve(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=uve.exec(t);if(e!==null)return Number(e[1])},uve=/^fd(\d+)$/,dve=(t,e)=>t.map(r=>r===void 0?pve[e]:r),fve=ive("execa").enabled?"full":"none",pve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:fve,stripFinalNewline:!0},OR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Ol,Rl,vZ,RR,mve,ab,cb,ps=y(()=>{xo();Ol=({verbose:t},e)=>RR(t,e)!=="none",Rl=({verbose:t},e)=>!["none","short"].includes(RR(t,e)),vZ=({verbose:t},e)=>{let r=RR(t,e);return ab(r)?r:void 0},RR=(t,e)=>e===void 0?mve(t):wo(t,e),mve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as hve}from"node:process";import{stripVTControlCharacters as gve}from"node:util";var SZ,Qf,wZ,yve,_ve,bve,vve,Sve,wve,xve,lb=y(()=>{SZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>wve(wZ(o))).join(" ");return{command:n,escapedCommand:i}},Qf=t=>gve(t).split(` `).map(e=>wZ(e)).join(` -`),wZ=t=>t.replaceAll(gve,e=>mve(e)),mve=t=>{let e=yve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=_ve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},hve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},gve=hve(),yve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},_ve=65535,bve=t=>vve.test(t)?t:fve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,vve=/^[\w./-]+$/});import xZ from"node:process";function RR(){let{env:t}=xZ,{TERM:e,TERM_PROGRAM:r}=t;return xZ.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 $Z=y(()=>{});var kZ,EZ,Sve,wve,xve,$ve,kve,ub,dtt,AZ=y(()=>{$Z();kZ={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"},EZ={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"},Sve={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"},wve={...kZ,...EZ},xve={...kZ,...Sve},$ve=RR(),kve=$ve?wve:xve,ub=kve,dtt=Object.entries(EZ)});import Eve from"node:tty";var Ave,ve,mtt,TZ,htt,gtt,ytt,_tt,btt,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,Ttt,Ott,db,Rtt,Itt,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,OZ,Ltt,RZ,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,IR=y(()=>{Ave=Eve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Ave)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}},mtt=ve(0,0),TZ=ve(1,22),htt=ve(2,22),gtt=ve(3,23),ytt=ve(4,24),_tt=ve(53,55),btt=ve(7,27),vtt=ve(8,28),Stt=ve(9,29),wtt=ve(30,39),xtt=ve(31,39),$tt=ve(32,39),ktt=ve(33,39),Ett=ve(34,39),Att=ve(35,39),Ttt=ve(36,39),Ott=ve(37,39),db=ve(90,39),Rtt=ve(40,49),Itt=ve(41,49),Ptt=ve(42,49),Ctt=ve(43,49),Dtt=ve(44,49),Ntt=ve(45,49),jtt=ve(46,49),Mtt=ve(47,49),Ftt=ve(100,49),OZ=ve(91,39),Ltt=ve(92,39),RZ=ve(93,39),ztt=ve(94,39),Utt=ve(95,39),qtt=ve(96,39),Htt=ve(97,39),Btt=ve(101,49),Gtt=ve(102,49),Ztt=ve(103,49),Vtt=ve(104,49),Wtt=ve(105,49),Ktt=ve(106,49),Jtt=ve(107,49)});var IZ=y(()=>{IR();IR()});var DZ,Ove,fb,PZ,Rve,CZ,Ive,NZ=y(()=>{AZ();IZ();DZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Ove(r),c=Rve[t]({failed:o,reject:s,piped:n}),l=Ive[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},Ove=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"),PZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Rve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PZ,duration:PZ},CZ=t=>t,Ive={command:()=>TZ,output:()=>CZ,ipc:()=>CZ,error:({reject:t})=>t?OZ:RZ,duration:()=>db}});var jZ,Pve,Cve,MZ=y(()=>{ps();jZ=(t,e,r)=>{let n=vZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Pve(i,o,n)).filter(i=>i!==void 0).map(i=>Cve(i)).join("")},Pve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Cve=t=>t.endsWith(` +`),wZ=t=>t.replaceAll(bve,e=>yve(e)),yve=t=>{let e=vve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Sve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},_ve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},bve=_ve(),vve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Sve=65535,wve=t=>xve.test(t)?t:hve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,xve=/^[\w./-]+$/});import xZ from"node:process";function IR(){let{env:t}=xZ,{TERM:e,TERM_PROGRAM:r}=t;return xZ.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 $Z=y(()=>{});var kZ,EZ,$ve,kve,Eve,Ave,Tve,ub,gtt,AZ=y(()=>{$Z();kZ={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"},EZ={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"},kve={...kZ,...EZ},Eve={...kZ,...$ve},Ave=IR(),Tve=Ave?kve:Eve,ub=Tve,gtt=Object.entries(EZ)});import Ove from"node:tty";var Rve,ve,btt,TZ,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,Ttt,Ott,Rtt,Itt,Ptt,Ctt,Dtt,db,Ntt,jtt,Mtt,Ftt,Ltt,ztt,Utt,qtt,Htt,OZ,Btt,RZ,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,Ytt,Xtt,Qtt,ert,trt,PR=y(()=>{Rve=Ove?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Rve)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}},btt=ve(0,0),TZ=ve(1,22),vtt=ve(2,22),Stt=ve(3,23),wtt=ve(4,24),xtt=ve(53,55),$tt=ve(7,27),ktt=ve(8,28),Ett=ve(9,29),Att=ve(30,39),Ttt=ve(31,39),Ott=ve(32,39),Rtt=ve(33,39),Itt=ve(34,39),Ptt=ve(35,39),Ctt=ve(36,39),Dtt=ve(37,39),db=ve(90,39),Ntt=ve(40,49),jtt=ve(41,49),Mtt=ve(42,49),Ftt=ve(43,49),Ltt=ve(44,49),ztt=ve(45,49),Utt=ve(46,49),qtt=ve(47,49),Htt=ve(100,49),OZ=ve(91,39),Btt=ve(92,39),RZ=ve(93,39),Gtt=ve(94,39),Ztt=ve(95,39),Vtt=ve(96,39),Wtt=ve(97,39),Ktt=ve(101,49),Jtt=ve(102,49),Ytt=ve(103,49),Xtt=ve(104,49),Qtt=ve(105,49),ert=ve(106,49),trt=ve(107,49)});var IZ=y(()=>{PR();PR()});var DZ,Pve,fb,PZ,Cve,CZ,Dve,NZ=y(()=>{AZ();IZ();DZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Pve(r),c=Cve[t]({failed:o,reject:s,piped:n}),l=Dve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},Pve=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"),PZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Cve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PZ,duration:PZ},CZ=t=>t,Dve={command:()=>TZ,output:()=>CZ,ipc:()=>CZ,error:({reject:t})=>t?OZ:RZ,duration:()=>db}});var jZ,Nve,jve,MZ=y(()=>{ps();jZ=(t,e,r)=>{let n=vZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Nve(i,o,n)).filter(i=>i!==void 0).map(i=>jve(i)).join("")},Nve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},jve=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Dve}from"node:util";var Ci,Nve,jve,Mve,pb,Fve,Rl=y(()=>{lb();NZ();MZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Nve({type:t,result:i,verboseInfo:n}),s=jve(e,o),a=jZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Nve=({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}),jve=(t,e)=>t.split(` -`).map(r=>Mve({...e,message:r})),Mve=t=>({verboseLine:DZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Dve(t);return Qf(e).replaceAll(" "," ".repeat(Fve))},Fve=2});var FZ,LZ=y(()=>{ps();Rl();FZ=(t,e)=>{Tl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var zZ,Lve,zve,Uve,UZ=y(()=>{ps();zZ=(t,e,r)=>{Uve(t);let n=Lve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Lve=t=>Tl({verbose:t})?zve++:void 0,zve=0n,Uve=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 qZ}from"node:process";var mb,PR,hb=y(()=>{mb=()=>qZ.bigint(),PR=t=>Number(qZ.bigint()-t)/1e6});var gb,CR=y(()=>{LZ();UZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=SZ(t,e),s=ER(r,"verbose"),a=zZ(s,o,{...r});return FZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VZ=v((wrt,ZZ)=>{ZZ.exports=GZ;GZ.sync=Hve;var HZ=Ge("fs");function qve(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{YZ.exports=KZ;KZ.sync=Bve;var WZ=Ge("fs");function KZ(t,e,r){WZ.stat(t,function(n,i){r(n,n?!1:JZ(i,e))})}function Bve(t,e){return JZ(WZ.statSync(t),e)}function JZ(t,e){return t.isFile()&&Gve(t,e)}function Gve(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 eV=v((krt,QZ)=>{var $rt=Ge("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=VZ():yb=XZ();QZ.exports=DR;DR.sync=Zve;function DR(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){DR(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 Zve(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aV=v((Ert,sV)=>{var Il=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tV=Ge("path"),Vve=Il?";":":",rV=eV(),nV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iV=(t,e)=>{let r=e.colon||Vve,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}},oV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tV.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];rV(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)},Wve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iV(t,e),o=[];for(let s=0;s{"use strict";var cV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};NR.exports=cV;NR.exports.default=cV});var pV=v((Trt,fV)=>{"use strict";var uV=Ge("path"),Kve=aV(),Jve=lV();function dV(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=Kve.sync(t.command,{path:r[Jve({env:r})],pathExt:e?uV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uV.resolve(i?t.options.cwd:"",s)),s}function Yve(t){return dV(t)||dV(t,!0)}fV.exports=Yve});var mV=v((Ort,MR)=>{"use strict";var jR=/([()\][%!^"`<>&|;, *?])/g;function Xve(t){return t=t.replace(jR,"^$1"),t}function Qve(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(jR,"^$1"),e&&(t=t.replace(jR,"^$1")),t}MR.exports.command=Xve;MR.exports.argument=Qve});var gV=v((Rrt,hV)=>{"use strict";hV.exports=/^#!(.*)/});var _V=v((Irt,yV)=>{"use strict";var eSe=gV();yV.exports=(t="")=>{let e=t.match(eSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vV=v((Prt,bV)=>{"use strict";var FR=Ge("fs"),tSe=_V();function rSe(t){let r=Buffer.alloc(150),n;try{n=FR.openSync(t,"r"),FR.readSync(n,r,0,150,0),FR.closeSync(n)}catch{}return tSe(r.toString())}bV.exports=rSe});var $V=v((Crt,xV)=>{"use strict";var nSe=Ge("path"),SV=pV(),wV=mV(),iSe=vV(),oSe=process.platform==="win32",sSe=/\.(?:com|exe)$/i,aSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function cSe(t){t.file=SV(t);let e=t.file&&iSe(t.file);return e?(t.args.unshift(t.file),t.command=e,SV(t)):t.file}function lSe(t){if(!oSe)return t;let e=cSe(t),r=!sSe.test(e);if(t.options.forceShell||r){let n=aSe.test(e);t.command=nSe.normalize(t.command),t.command=wV.command(t.command),t.args=t.args.map(o=>wV.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 uSe(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:lSe(n)}xV.exports=uSe});var AV=v((Drt,EV)=>{"use strict";var LR=process.platform==="win32";function zR(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 dSe(t,e){if(!LR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kV(t,e){return LR&&t===1&&!e.file?zR(e.original,"spawn"):null}function fSe(t,e){return LR&&t===1&&!e.file?zR(e.original,"spawnSync"):null}EV.exports={hookChildProcess:dSe,verifyENOENT:kV,verifyENOENTSync:fSe,notFoundError:zR}});var RV=v((Nrt,Pl)=>{"use strict";var TV=Ge("child_process"),UR=$V(),qR=AV();function OV(t,e,r){let n=UR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return qR.hookChildProcess(i,n),i}function pSe(t,e,r){let n=UR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||qR.verifyENOENTSync(i.status,n),i}Pl.exports=OV;Pl.exports.spawn=OV;Pl.exports.sync=pSe;Pl.exports._parse=UR;Pl.exports._enoent=qR});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 IV=y(()=>{});var PV=y(()=>{});import{promisify as mSe}from"node:util";import{execFile as hSe,execFileSync as zrt}from"node:child_process";import CV from"node:path";import{fileURLToPath as gSe}from"node:url";function bb(t){return t instanceof URL?gSe(t):t}function DV(t){return{*[Symbol.iterator](){let e=CV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=CV.resolve(e,"..")}}}var Hrt,Brt,NV=y(()=>{PV();Hrt=mSe(hSe);Brt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var ySe,_Se,bSe,jV,MV=y(()=>{IV();NV();ySe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&_Se(s,a,o),i&&bSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},_Se=(t,e,r)=>{for(let n of DV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},bSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},jV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=ySe(e),t}});var FV,ni,LV,zV,UV,Sb,ep,tp,Da=y(()=>{FV=(t,e,r)=>{let n=r?tp:ep,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},LV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zV=t=>Sb(t)&&UV in t,UV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",ep=class extends Error{};LV(ep,ep.name);tp=class extends Error{};LV(tp,tp.name)});var qV,vSe,HV,BV,GV=y(()=>{qV=()=>{let t=BV-HV+1;return Array.from({length:t},vSe)},vSe=(t,e)=>({name:`SIGRT${e+1}`,number:HV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),HV=34,BV=64});var ZV,VV=y(()=>{ZV=[{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 SSe}from"node:os";var HR,wSe,WV=y(()=>{VV();GV();HR=()=>{let t=qV();return[...ZV,...t].map(wSe)},wSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=SSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as xSe}from"node:os";var $Se,kSe,KV,ESe,ASe,TSe,ant,JV=y(()=>{WV();$Se=()=>{let t=HR();return Object.fromEntries(t.map(kSe))},kSe=({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}],KV=$Se(),ESe=()=>{let t=HR(),e=65,r=Array.from({length:e},(n,i)=>ASe(i,t));return Object.assign({},...r)},ASe=(t,e)=>{let r=TSe(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}}},TSe=(t,e)=>{let r=e.find(({name:n})=>xSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},ant=ESe()});import{constants as rp}from"node:os";var XV,QV,e9,OSe,RSe,YV,ISe,BR,PSe,CSe,wb,np=y(()=>{JV();XV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QV=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return OSe(t,e);if(typeof t=="string")return ISe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${BR()}`)},OSe=(t,e)=>{if(YV.has(t))return YV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${BR()}`)},RSe=()=>new Map(Object.entries(rp.signals).reverse().map(([t,e])=>[e,t])),YV=RSe(),ISe=(t,e)=>{if(t in rp.signals)return t;throw t.toUpperCase()in rp.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${BR()}`)},BR=()=>`Available signal names: ${PSe()}. -Available signal numbers: ${CSe()}.`,PSe=()=>Object.keys(rp.signals).sort().map(t=>`'${t}'`).join(", "),CSe=()=>[...new Set(Object.values(rp.signals).sort((t,e)=>t-e))].join(", "),wb=t=>KV[t].description});import{setTimeout as DSe}from"node:timers/promises";var t9,NSe,r9,jSe,MSe,FSe,GR,xb=y(()=>{Da();np();t9=t=>{if(t===!1)return t;if(t===!0)return NSe;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},NSe=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=jSe(s,a,r);MSe(l,n);let u=t(c);return FSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},jSe=(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:QV(n),error:i}},MSe=(t,e)=>{t!==void 0&&e.reject(t)},FSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&GR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},GR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await DSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as LSe}from"node:events";var $b,ZR=y(()=>{$b=async(t,e)=>{t.aborted||await LSe(t,"abort",{signal:e})}});var n9,i9,zSe,VR=y(()=>{ZR();n9=({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)}`)},i9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[zSe(t,e,n,i)],zSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Cl,USe,WR,o9,s9,kb,a9,c9,l9,u9,d9,f9,qSe,HSe,BSe,ii,GSe,ms,Dl,Nl=y(()=>{Cl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{USe(t,e,r),WR(t,e,n)},USe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},WR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},s9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Mve}from"node:util";var Ci,Fve,Lve,zve,pb,Uve,Il=y(()=>{lb();NZ();MZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Fve({type:t,result:i,verboseInfo:n}),s=Lve(e,o),a=jZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Fve=({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}),Lve=(t,e)=>t.split(` +`).map(r=>zve({...e,message:r})),zve=t=>({verboseLine:DZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Mve(t);return Qf(e).replaceAll(" "," ".repeat(Uve))},Uve=2});var FZ,LZ=y(()=>{ps();Il();FZ=(t,e)=>{Ol(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var zZ,qve,Hve,Bve,UZ=y(()=>{ps();zZ=(t,e,r)=>{Bve(t);let n=qve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},qve=t=>Ol({verbose:t})?Hve++:void 0,Hve=0n,Bve=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 qZ}from"node:process";var mb,CR,hb=y(()=>{mb=()=>qZ.bigint(),CR=t=>Number(qZ.bigint()-t)/1e6});var gb,DR=y(()=>{LZ();UZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=SZ(t,e),s=AR(r,"verbose"),a=zZ(s,o,{...r});return FZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VZ=v((Art,ZZ)=>{ZZ.exports=GZ;GZ.sync=Zve;var HZ=Ge("fs");function Gve(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{YZ.exports=KZ;KZ.sync=Vve;var WZ=Ge("fs");function KZ(t,e,r){WZ.stat(t,function(n,i){r(n,n?!1:JZ(i,e))})}function Vve(t,e){return JZ(WZ.statSync(t),e)}function JZ(t,e){return t.isFile()&&Wve(t,e)}function Wve(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 eV=v((Rrt,QZ)=>{var Ort=Ge("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=VZ():yb=XZ();QZ.exports=NR;NR.sync=Kve;function NR(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){NR(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 Kve(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aV=v((Irt,sV)=>{var Pl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tV=Ge("path"),Jve=Pl?";":":",rV=eV(),nV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iV=(t,e)=>{let r=e.colon||Jve,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}},oV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tV.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];rV(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)},Yve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iV(t,e),o=[];for(let s=0;s{"use strict";var cV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};jR.exports=cV;jR.exports.default=cV});var pV=v((Crt,fV)=>{"use strict";var uV=Ge("path"),Xve=aV(),Qve=lV();function dV(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=Xve.sync(t.command,{path:r[Qve({env:r})],pathExt:e?uV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uV.resolve(i?t.options.cwd:"",s)),s}function eSe(t){return dV(t)||dV(t,!0)}fV.exports=eSe});var mV=v((Drt,FR)=>{"use strict";var MR=/([()\][%!^"`<>&|;, *?])/g;function tSe(t){return t=t.replace(MR,"^$1"),t}function rSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(MR,"^$1"),e&&(t=t.replace(MR,"^$1")),t}FR.exports.command=tSe;FR.exports.argument=rSe});var gV=v((Nrt,hV)=>{"use strict";hV.exports=/^#!(.*)/});var _V=v((jrt,yV)=>{"use strict";var nSe=gV();yV.exports=(t="")=>{let e=t.match(nSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vV=v((Mrt,bV)=>{"use strict";var LR=Ge("fs"),iSe=_V();function oSe(t){let r=Buffer.alloc(150),n;try{n=LR.openSync(t,"r"),LR.readSync(n,r,0,150,0),LR.closeSync(n)}catch{}return iSe(r.toString())}bV.exports=oSe});var $V=v((Frt,xV)=>{"use strict";var sSe=Ge("path"),SV=pV(),wV=mV(),aSe=vV(),cSe=process.platform==="win32",lSe=/\.(?:com|exe)$/i,uSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function dSe(t){t.file=SV(t);let e=t.file&&aSe(t.file);return e?(t.args.unshift(t.file),t.command=e,SV(t)):t.file}function fSe(t){if(!cSe)return t;let e=dSe(t),r=!lSe.test(e);if(t.options.forceShell||r){let n=uSe.test(e);t.command=sSe.normalize(t.command),t.command=wV.command(t.command),t.args=t.args.map(o=>wV.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 pSe(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:fSe(n)}xV.exports=pSe});var AV=v((Lrt,EV)=>{"use strict";var zR=process.platform==="win32";function UR(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 mSe(t,e){if(!zR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kV(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawn"):null}function hSe(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawnSync"):null}EV.exports={hookChildProcess:mSe,verifyENOENT:kV,verifyENOENTSync:hSe,notFoundError:UR}});var RV=v((zrt,Cl)=>{"use strict";var TV=Ge("child_process"),qR=$V(),HR=AV();function OV(t,e,r){let n=qR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return HR.hookChildProcess(i,n),i}function gSe(t,e,r){let n=qR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||HR.verifyENOENTSync(i.status,n),i}Cl.exports=OV;Cl.exports.spawn=OV;Cl.exports.sync=gSe;Cl.exports._parse=qR;Cl.exports._enoent=HR});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 IV=y(()=>{});var PV=y(()=>{});import{promisify as ySe}from"node:util";import{execFile as _Se,execFileSync as Grt}from"node:child_process";import CV from"node:path";import{fileURLToPath as bSe}from"node:url";function bb(t){return t instanceof URL?bSe(t):t}function DV(t){return{*[Symbol.iterator](){let e=CV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=CV.resolve(e,"..")}}}var Wrt,Krt,NV=y(()=>{PV();Wrt=ySe(_Se);Krt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var vSe,SSe,wSe,jV,MV=y(()=>{IV();NV();vSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&SSe(s,a,o),i&&wSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},SSe=(t,e,r)=>{for(let n of DV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},wSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},jV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=vSe(e),t}});var FV,ni,LV,zV,UV,Sb,ep,tp,Da=y(()=>{FV=(t,e,r)=>{let n=r?tp:ep,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},LV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zV=t=>Sb(t)&&UV in t,UV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",ep=class extends Error{};LV(ep,ep.name);tp=class extends Error{};LV(tp,tp.name)});var qV,xSe,HV,BV,GV=y(()=>{qV=()=>{let t=BV-HV+1;return Array.from({length:t},xSe)},xSe=(t,e)=>({name:`SIGRT${e+1}`,number:HV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),HV=34,BV=64});var ZV,VV=y(()=>{ZV=[{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 BR,kSe,WV=y(()=>{VV();GV();BR=()=>{let t=qV();return[...ZV,...t].map(kSe)},kSe=({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 ESe}from"node:os";var ASe,TSe,KV,OSe,RSe,ISe,fnt,JV=y(()=>{WV();ASe=()=>{let t=BR();return Object.fromEntries(t.map(TSe))},TSe=({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}],KV=ASe(),OSe=()=>{let t=BR(),e=65,r=Array.from({length:e},(n,i)=>RSe(i,t));return Object.assign({},...r)},RSe=(t,e)=>{let r=ISe(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}}},ISe=(t,e)=>{let r=e.find(({name:n})=>ESe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},fnt=OSe()});import{constants as rp}from"node:os";var XV,QV,e9,PSe,CSe,YV,DSe,GR,NSe,jSe,wb,np=y(()=>{JV();XV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QV=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return PSe(t,e);if(typeof t=="string")return DSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${GR()}`)},PSe=(t,e)=>{if(YV.has(t))return YV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${GR()}`)},CSe=()=>new Map(Object.entries(rp.signals).reverse().map(([t,e])=>[e,t])),YV=CSe(),DSe=(t,e)=>{if(t in rp.signals)return t;throw t.toUpperCase()in rp.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. +${GR()}`)},GR=()=>`Available signal names: ${NSe()}. +Available signal numbers: ${jSe()}.`,NSe=()=>Object.keys(rp.signals).sort().map(t=>`'${t}'`).join(", "),jSe=()=>[...new Set(Object.values(rp.signals).sort((t,e)=>t-e))].join(", "),wb=t=>KV[t].description});import{setTimeout as MSe}from"node:timers/promises";var t9,FSe,r9,LSe,zSe,USe,ZR,xb=y(()=>{Da();np();t9=t=>{if(t===!1)return t;if(t===!0)return FSe;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},FSe=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=LSe(s,a,r);zSe(l,n);let u=t(c);return USe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},LSe=(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:QV(n),error:i}},zSe=(t,e)=>{t!==void 0&&e.reject(t)},USe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&ZR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},ZR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await MSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as qSe}from"node:events";var $b,VR=y(()=>{$b=async(t,e)=>{t.aborted||await qSe(t,"abort",{signal:e})}});var n9,i9,HSe,WR=y(()=>{VR();n9=({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)}`)},i9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[HSe(t,e,n,i)],HSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Dl,BSe,KR,o9,s9,kb,a9,c9,l9,u9,d9,f9,GSe,ZSe,VSe,ii,WSe,ms,Nl,jl=y(()=>{Dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{BSe(t,e,r),KR(t,e,n)},BSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},KR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},s9=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}")}, -]);`)},kb=(t,e)=>new Error(`${ii("sendMessage",e)} failed when sending an acknowledgment response to the ${ms(e)}.`,{cause:t}),a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),u9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},d9=({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})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(qSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},qSe=({code:t,message:e})=>HSe.has(t)||BSe.some(r=>e.includes(r)),HSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),BSe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${GSe(e)}${t}(${r})`,GSe=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 Ab,Ml,Ni,p9,ZSe,VSe,m9,WSe,h9,ip,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},Ml=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(m9(o,e,n,!1));return s},Ni=new WeakMap,p9=(t,e,r)=>{let n=ZSe(e,r);return VSe(n,e,r,t),n},ZSe=(t,e)=>{let r=AR(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(`"${ip(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}),a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),u9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},d9=({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})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(GSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},GSe=({code:t,message:e})=>ZSe.has(t)||VSe.some(r=>e.includes(r)),ZSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),VSe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${WSe(e)}${t}(${r})`,WSe=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,p9,KSe,JSe,m9,YSe,h9,ip,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},Fl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(m9(o,e,n,!1));return s},Ni=new WeakMap,p9=(t,e,r)=>{let n=KSe(e,r);return JSe(n,e,r,t),n},KSe=(t,e)=>{let r=TR(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(`"${ip(e)}" must not be "${t}". It must be ${n} or "fd3", "fd4" (and so on). -It is optional and defaults to "${i}".`)},VSe=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${ip(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(`"${ip(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ip(r)}" must not be ${e}. It must be a writable stream, not readable.`)},m9=(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}=WSe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${ip(n)}: ${Eb(e)}". -Please set this option with "pipe" instead.`},WSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=h9(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]}},h9=t=>t==="all"?1:t,ip=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as KSe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),KSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,KR,Rb,JR,g9,y9,op=y(()=>{Ob=(t,e)=>{e&&KR(t)},KR=t=>{t.refCounted()},Rb=(t,e)=>{e&&JR(t)},JR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(JR(t),JR(t))},y9=(t,e)=>{e&&(KR(t),KR(t))}});import{once as JSe}from"node:events";import{scheduler as YSe}from"node:timers/promises";var _9,b9,Ib,v9=y(()=>{Cb();op();Pb();Db();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(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 x9(t,n,i),await YSe.yield();let s=await S9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{YR();let o=Ib.get(t);for(;o?.length>0;)await JSe(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as XSe}from"node:events";var gs,Nb,QSe,jb,sp=y(()=>{v9();op();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new XSe;return n.connected=!0,Nb.set(t,n),QSe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,QSe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=_9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),g9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as ewe}from"node:events";var k9,twe,E9,S9,w9,A9,Mb,rwe,Fb,T9,Pb=y(()=>{jl();Tb();Ub();Nl();sp();Cb();k9=({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:twe++,type:Fb,message:n,hasListeners:s}},twe=0n,E9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},S9=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:T9,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},w9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=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,rwe(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},rwe=async(t,e,{signal:r})=>{Na(t,1,r),await ewe(t,"disconnect",{signal:r}),c9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,ap,Lb,nwe,Cb=y(()=>{jl();xo();hs();Pb();O9=(t,e,r)=>{ap.has(t)||ap.set(t,new Set);let n=ap.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},R9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},x9=async(t,e,r)=>{for(;!Lb(t,e)&&ap.get(t)?.size>0;){let n=[...ap.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},ap=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>nwe(t),nwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as iwe}from"node:util";var zb,owe,QR,swe,XR,Ub=y(()=>{Nl();Cb();Pb();zb=({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}),owe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},owe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=k9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=O9(t,s,o);try{await QR({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Dl(t),c}finally{R9(a)}},QR=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=swe(t);try{await Promise.all([A9(n,t,r),o(n)])}catch(s){throw d9({error:s,methodName:e,isSubprocess:r}),f9({error:s,methodName:e,isSubprocess:r,message:i}),s}},swe=t=>{if(XR.has(t))return XR.get(t);let e=iwe(t.send.bind(t));return XR.set(t,e),e},XR=new WeakMap});import{scheduler as awe}from"node:timers/promises";var P9,C9,cwe,I9,$9,D9,YR,eI,Db=y(()=>{Ub();sp();Nl();P9=(t,e)=>{let r="cancelSignal";return WR(r,!1,t.connected),QR({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await cwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),eI.signal),cwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){YR();return}gs(t,e,r),await awe.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(eI.abort(t.message),!0),D9="execa:ipc:cancel",YR=()=>{eI.abort(l9())},eI=new AbortController});var N9,j9,lwe,uwe,tI=y(()=>{ZR();Db();xb();N9=({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.")}},j9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[lwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],lwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=uwe(e);throw await P9(t,o),GR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},uwe=({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 dwe}from"node:timers/promises";var M9,F9,fwe,rI=y(()=>{Da();M9=({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})`)},F9=(t,e,r,n)=>e===0||e===void 0?[]:[fwe(t,e,r,n)],fwe=async(t,e,r,{signal:n})=>{throw await dwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as pwe,execArgv as mwe}from"node:process";import L9 from"node:path";var z9,U9,nI=y(()=>{Al();z9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},U9=(t,e,{node:r=!1,nodePath:n=pwe,nodeOptions:i=mwe.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=L9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(L9.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 hwe}from"node:v8";var q9,gwe,ywe,_we,H9,iI=y(()=>{q9=({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`.");_we[r](t)}},gwe=t=>{try{hwe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},ywe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},_we={advanced:gwe,json:ywe},H9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,bwe,cn,oI,vwe,B9,qb,ja=y(()=>{G9=({encoding:t})=>{if(oI.has(t))return;let e=vwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to ${qb(e)}.`);let r=[...oI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to one of: ${r}.`)},bwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),oI=new Set([...bwe,...cn]),vwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in B9)return B9[e];if(oI.has(e))return e},B9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Swe}from"node:fs";import wwe from"node:path";import xwe from"node:process";var Z9,V9,W9,sI=y(()=>{Al();Z9=(t=V9())=>{let e=El(t,'The "cwd" option');return wwe.resolve(e)},V9=()=>{try{return xwe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},W9=(t,e)=>{if(e===V9())return t;let r;try{r=Swe(e)}catch(n){return`The "cwd" option is invalid: ${e}. +It is optional and defaults to "${i}".`)},JSe=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${ip(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(`"${ip(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ip(r)}" must not be ${e}. It must be a writable stream, not readable.`)},m9=(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}=YSe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${ip(n)}: ${Eb(e)}". +Please set this option with "pipe" instead.`},YSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=h9(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]}},h9=t=>t==="all"?1:t,ip=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as XSe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),XSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,JR,Rb,YR,g9,y9,op=y(()=>{Ob=(t,e)=>{e&&JR(t)},JR=t=>{t.refCounted()},Rb=(t,e)=>{e&&YR(t)},YR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(YR(t),YR(t))},y9=(t,e)=>{e&&(JR(t),JR(t))}});import{once as QSe}from"node:events";import{scheduler as ewe}from"node:timers/promises";var _9,b9,Ib,v9=y(()=>{Cb();op();Pb();Db();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(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 x9(t,n,i),await ewe.yield();let s=await S9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{XR();let o=Ib.get(t);for(;o?.length>0;)await QSe(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as twe}from"node:events";var gs,Nb,rwe,jb,sp=y(()=>{v9();op();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new twe;return n.connected=!0,Nb.set(t,n),rwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,rwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=_9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),g9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as nwe}from"node:events";var k9,iwe,E9,S9,w9,A9,Mb,owe,Fb,T9,Pb=y(()=>{Ml();Tb();Ub();jl();sp();Cb();k9=({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:iwe++,type:Fb,message:n,hasListeners:s}},iwe=0n,E9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},S9=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:T9,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},w9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=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,owe(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},owe=async(t,e,{signal:r})=>{Na(t,1,r),await nwe(t,"disconnect",{signal:r}),c9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,ap,Lb,swe,Cb=y(()=>{Ml();xo();hs();Pb();O9=(t,e,r)=>{ap.has(t)||ap.set(t,new Set);let n=ap.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},R9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},x9=async(t,e,r)=>{for(;!Lb(t,e)&&ap.get(t)?.size>0;){let n=[...ap.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},ap=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>swe(t),swe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as awe}from"node:util";var zb,cwe,eI,lwe,QR,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}),cwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},cwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=k9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=O9(t,s,o);try{await eI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Nl(t),c}finally{R9(a)}},eI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=lwe(t);try{await Promise.all([A9(n,t,r),o(n)])}catch(s){throw d9({error:s,methodName:e,isSubprocess:r}),f9({error:s,methodName:e,isSubprocess:r,message:i}),s}},lwe=t=>{if(QR.has(t))return QR.get(t);let e=awe(t.send.bind(t));return QR.set(t,e),e},QR=new WeakMap});import{scheduler as uwe}from"node:timers/promises";var P9,C9,dwe,I9,$9,D9,XR,tI,Db=y(()=>{Ub();sp();jl();P9=(t,e)=>{let r="cancelSignal";return KR(r,!1,t.connected),eI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await dwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),tI.signal),dwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){XR();return}gs(t,e,r),await uwe.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(tI.abort(t.message),!0),D9="execa:ipc:cancel",XR=()=>{tI.abort(l9())},tI=new AbortController});var N9,j9,fwe,pwe,rI=y(()=>{VR();Db();xb();N9=({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.")}},j9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[fwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],fwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=pwe(e);throw await P9(t,o),ZR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},pwe=({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 mwe}from"node:timers/promises";var M9,F9,hwe,nI=y(()=>{Da();M9=({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})`)},F9=(t,e,r,n)=>e===0||e===void 0?[]:[hwe(t,e,r,n)],hwe=async(t,e,r,{signal:n})=>{throw await mwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as gwe,execArgv as ywe}from"node:process";import L9 from"node:path";var z9,U9,iI=y(()=>{Tl();z9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},U9=(t,e,{node:r=!1,nodePath:n=gwe,nodeOptions:i=ywe.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=L9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(L9.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 _we}from"node:v8";var q9,bwe,vwe,Swe,H9,oI=y(()=>{q9=({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`.");Swe[r](t)}},bwe=t=>{try{_we(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},vwe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Swe={advanced:bwe,json:vwe},H9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,wwe,cn,sI,xwe,B9,qb,ja=y(()=>{G9=({encoding:t})=>{if(sI.has(t))return;let e=xwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to ${qb(e)}.`);let r=[...sI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to one of: ${r}.`)},wwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),sI=new Set([...wwe,...cn]),xwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in B9)return B9[e];if(sI.has(e))return e},B9={"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 kwe from"node:path";import Ewe from"node:process";var Z9,V9,W9,aI=y(()=>{Tl();Z9=(t=V9())=>{let e=Al(t,'The "cwd" option');return kwe.resolve(e)},V9=()=>{try{return Ewe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},W9=(t,e)=>{if(e===V9())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 $we from"node:path";import K9 from"node:process";var J9,Hb,kwe,Ewe,aI=y(()=>{J9=wt(RV(),1);MV();xb();np();VR();tI();rI();nI();iI();ja();sI();Al();xo();Hb=(t,e,r)=>{r.cwd=Z9(r.cwd);let[n,i,o]=U9(t,e,r),{command:s,args:a,options:c}=J9.default._parse(n,i,o),l=bZ(c),u=kwe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=wR(u.shell),u.env=Ewe(u),u.killSignal=XV(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&$we.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},kwe=({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}),Ewe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,cI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function Fl(t){if(typeof t=="string")return Awe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Twe(t)}var Awe,Twe,Y9,Owe,X9,Rwe,lI=y(()=>{Awe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,Twe=t=>t.at(-1)===Owe?t.subarray(0,t.at(-2)===Rwe?-2:-1):t,Y9=` -`,Owe=Y9.codePointAt(0),X9="\r",Rwe=X9.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 uI(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 dI(t,e){return uI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function Q9(){return this[pI].next()}function eW(t){return this[pI].return(t)}function mI({preventCancel:t=!1}={}){let e=this.getReader(),r=new fI(e,t),n=Object.create(Pwe);return n[pI]=r,n}var Iwe,fI,pI,Pwe,tW=y(()=>{Iwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),fI=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}}},pI=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eW,"name",{value:"return"});Pwe=Object.create(Iwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eW}})});var rW=y(()=>{});var nW=y(()=>{tW();rW()});var iW,Cwe,Dwe,Nwe,cp,hI=y(()=>{Fa();nW();iW=t=>{if(Ma(t,{checkOpen:!1})&&cp.on!==void 0)return Dwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Cwe.call(t)==="[object ReadableStream]")return mI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Cwe}=Object.prototype,Dwe=async function*(t){let e=new AbortController,r={};Nwe(t,e,r);try{for await(let[n]of cp.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()}},Nwe=async(t,e,r)=>{try{await cp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},cp={}});var Ll,jwe,aW,oW,Mwe,sW,ji,lp=y(()=>{hI();Ll=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iW(t),u=e();u.length=0;try{for await(let d of l){let f=Mwe(d),p=r[f](d,u);aW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return jwe({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}},jwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oW(c,e,i,o),new ji},oW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Mwe=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=sW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,up,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,up=()=>{},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 Ll(t,Uwe,e)}var Fwe,Lwe,zwe,Uwe,cW=y(()=>{lp();Wb();Fwe=()=>({contents:[]}),Lwe=()=>1,zwe=(t,{contents:e})=>(e.push(t),e),Uwe={init:Fwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Lwe,truncateChunk:up,addChunk:zwe,getFinalChunk:up,finalize:Gb}});async function Jb(t,e){return Ll(t,Jwe,e)}var qwe,Hwe,Bwe,lW,uW,Gwe,Zwe,Vwe,Wwe,fW,dW,Kwe,pW,Jwe,mW=y(()=>{lp();Wb();qwe=()=>({contents:new ArrayBuffer(0)}),Hwe=t=>Bwe.encode(t),Bwe=new TextEncoder,lW=t=>new Uint8Array(t),uW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Gwe=(t,e)=>t.slice(0,e),Zwe=(t,{contents:e,length:r},n)=>{let i=pW()?Wwe(e,n):Vwe(e,n);return new Uint8Array(i).set(t,r),i},Vwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Wwe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fW=t=>dW**Math.ceil(Math.log(t)/Math.log(dW)),dW=2,Kwe=({contents:t,length:e})=>pW()?t:t.slice(0,e),pW=()=>"resize"in ArrayBuffer.prototype,Jwe={init:qwe,convertChunk:{string:Hwe,buffer:lW,arrayBuffer:lW,dataView:uW,typedArray:uW,others:Zb},getSize:Vb,truncateChunk:Gwe,addChunk:Zwe,getFinalChunk:up,finalize:Kwe}});async function Xb(t,e){return Ll(t,txe,e)}var Ywe,Yb,Xwe,Qwe,exe,txe,hW=y(()=>{lp();Wb();Ywe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),Xwe=(t,{contents:e})=>e+t,Qwe=(t,e)=>t.slice(0,e),exe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},txe={init:Ywe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:Qwe,addChunk:Xwe,getFinalChunk:exe,finalize:Gb}});var gW=y(()=>{cW();mW();hW();lp()});import{on as rxe}from"node:events";import{finished as nxe}from"node:stream/promises";var Qb=y(()=>{hI();gW();Object.assign(cp,{on:rxe,finished:nxe})});var yW,ixe,_W,bW,oxe,vW,SW,ev,La=y(()=>{Qb();So();xo();yW=({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=ixe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},ixe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_W=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},bW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=oxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},oxe=(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}},vW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),SW=(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 sxe}from"node:util";var xW,axe,cxe,lxe,uxe,dxe,wW,$W=y(()=>{lI();an();sI();lb();La();np();Da();xW=({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=axe({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=lxe(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=>uxe(D)).join(` -`)].map(D=>Qf(Fl(dxe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:R,message:T}},axe=({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=cxe(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?`${bW(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"},cxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",lxe=(t,e)=>{if(t instanceof ni)return;let r=zV(t)?t.originalMessage:String(t?.message??t),n=Qf(W9(r,e));return n===""?void 0:n},uxe=t=>typeof t=="string"?t:sxe(t),dxe=t=>Array.isArray(t)?t.map(e=>Fl(wW(e))).filter(Boolean).join(` -`):wW(t),wW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,zl,dp,fxe,kW,pxe,fp=y(()=>{np();hb();Da();$W();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kW({command:t,escapedCommand:e,cwd:o,durationMs:PR(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})=>dp({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}),dp=({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}=pxe(l,u),{originalMessage:T,shortMessage:D,message:E}=xW({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=FV(t,E,x);return Object.assign(ae,fxe({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},fxe=({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})=>kW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:PR(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:[]}),kW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),pxe=(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 mxe(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(EW(t*1e3)%1e3),nanoseconds:Math.trunc(EW(t*1e6)%1e3)}}function hxe(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 gI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return mxe(t);break}case"bigint":return hxe(t)}throw new TypeError("Expected a finite number or bigint")}var EW,AW=y(()=>{EW=t=>Number.isFinite(t)?t:0});function yI(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+_xe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&gxe(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?" "+yxe(d,u):f;i.push(p)}},a=gI(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%bxe):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 gxe,yxe,_xe,bxe,TW=y(()=>{AW();gxe=t=>t===0||t===0n,yxe=(t,e)=>e===1||e===1n?t:`${t}s`,_xe=1e-7,bxe=24n*60n*60n*1000n});var OW,RW=y(()=>{Rl();OW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IW,vxe,PW=y(()=>{TW();ps();Rl();RW();IW=(t,e)=>{Tl(e)&&(OW(t,e),vxe(t,e))},vxe=(t,e)=>{let r=`(done in ${yI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Ul,rv=y(()=>{PW();Ul=(t,e,{reject:r})=>{if(IW(t,e),t.failed&&r)throw t;return t}});var NW,Sxe,wxe,jW,MW,CW,xxe,_I,DW,za,FW,$xe,nv,LW,kxe,Exe,bI,zW,Axe,UW,iv,Txe,vI,Oxe,Rxe,qW,Cn,ov,SI,HW,BW,ys,$r=y(()=>{Fa();bo();an();NW=(t,e)=>za(t)?"asyncGenerator":FW(t)?"generator":nv(t)?"fileUrl":kxe(t)?"filePath":Txe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Oxe(t)?"asyncIterable":Rxe(t)?"iterable":vI(t)?jW({transform:t},e):$xe(t)?Sxe(t,e):"native",Sxe=(t,e)=>dI(t.transform,{checkOpen:!1})?wxe(t,e):vI(t.transform)?jW(t,e):xxe(t,e),wxe=(t,e)=>(MW(t,e,"Duplex stream"),"duplex"),jW=(t,e)=>(MW(t,e,"web TransformStream"),"webTransform"),MW=({final:t,binary:e,objectMode:r},n,i)=>{CW(t,`${n}.final`,i),CW(e,`${n}.binary`,i),_I(r,`${n}.objectMode`)},CW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},xxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(dI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(vI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return _I(r,`${i}.binary`),_I(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},_I=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DW=t=>za(t)||FW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",$xe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",LW=t=>nv(t)&&t.protocol!=="file:",kxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Exe.has(e))&&bI(t.file),Exe=new Set(["file","append"]),bI=t=>typeof t=="string",zW=(t,e)=>t==="native"&&typeof e=="string"&&!Axe.has(e),Axe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Txe=t=>UW(t)||iv(t),vI=t=>UW(t?.readable)&&iv(t?.writable),Oxe=t=>qW(t)&&typeof t[Symbol.asyncIterator]=="function",Rxe=t=>qW(t)&&typeof t[Symbol.iterator]=="function",qW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),SI=new Set(["fileUrl","filePath"]),HW=new Set([...SI,"webStream","nodeStream"]),BW=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 wI,Ixe,Pxe,GW,xI=y(()=>{$r();wI=(t,e,r,n)=>n==="output"?Ixe(t,e,r):Pxe(t,e,r),Ixe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Pxe=(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}},GW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZW,Cxe,Dxe,Nxe,jxe,Mxe,Fxe,VW=y(()=>{bo();ja();$r();xI();ZW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Cxe(t,e,r,n)],Cxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Dxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Fxe(o,r)},Dxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Nxe({stdioItem:t,optionName:i}):e==="webTransform"?jxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Mxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Nxe=({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}}},jxe=({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}=wI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Mxe=({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}=wI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Fxe=(t,e)=>e==="input"?t.reverse():t});import $I from"node:process";var WW,Lxe,zxe,ql,kI,KW,Uxe,qxe,JW=y(()=>{Fa();$r();WW=(t,e,r)=>{let n=t.map(i=>Lxe(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)??qxe},Lxe=({type:t,value:e},r)=>zxe[r]??KW[t](e),zxe=["input","output","output"],ql=()=>{},kI=()=>"input",KW={generator:ql,asyncGenerator:ql,fileUrl:ql,filePath:ql,iterable:kI,asyncIterable:kI,uint8Array:kI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?uI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:ql,duplex:ql,native(t){let e=Uxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return KW.nodeStream(t)}},Uxe=t=>{if([0,$I.stdin].includes(t))return"input";if([1,2,$I.stdout,$I.stderr].includes(t))return"output"},qxe="output"});var YW,XW=y(()=>{YW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QW,Hxe,Bxe,eK,Gxe,Zxe,tK=y(()=>{So();XW();ps();QW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Hxe(t,n).map((a,c)=>eK(a,c));return o?Gxe(s,r,i):YW(s,e)},Hxe=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(Bxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},Bxe=t=>Pn.some(e=>t[e]!==void 0),eK=(t,e)=>Array.isArray(t)?t.map(r=>eK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),Gxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Ol(r,i)&&Zxe(n)?"ignore":n),Zxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Vxe}from"node:fs";import Wxe from"node:tty";var nK,Kxe,Jxe,Yxe,Xxe,rK,iK=y(()=>{Fa();So();an();hs();nK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Kxe({stdioItem:t,fdNumber:n,direction:i}):Xxe({stdioItem:t,fdNumber:n}),Kxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Jxe({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},Jxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=Yxe(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Wxe.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(Vxe(i)),optionName:e}}},Yxe=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},Xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rK=(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 oK,Qxe,e0e,t0e,r0e,sK=y(()=>{Fa();an();$r();oK=({input:t,inputFile:e},r)=>r===0?[...Qxe(t),...t0e(e)]:[],Qxe=t=>t===void 0?[]:[{type:e0e(t),value:t,optionName:"input"}],e0e=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.")},t0e=t=>t===void 0?[]:[{...r0e(t),optionName:"inputFile"}],r0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(bI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aK,cK,n0e,i0e,lK,o0e,s0e,uK,dK=y(()=>{$r();aK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=n0e(i,t);if(s.length!==0){if(o){i0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(HW.has(t))return lK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});BW.has(t)&&s0e({otherStdioItems:s,type:t,value:e,optionName:r})}},n0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),i0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{SI.has(e)&&lK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>o0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uK(s,n,e),i==="output"?o[0].stream:void 0},o0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,s0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uK(i,n,e)},uK=(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,a0e,c0e,l0e,u0e,d0e,f0e,p0e,m0e,h0e,g0e,y0e,EI,_0e,av=y(()=>{So();VW();xI();$r();JW();tK();iK();sK();dK();sv=(t,e,r,n)=>{let o=QW(e,r,n).map((a,c)=>a0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=h0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>_0e(a)),s},a0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=c0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WW(o,e,i),c=o.map(d=>nK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZW(c,i,a,r),u=GW(l,a);return m0e(l,u),{direction:a,objectMode:u,stdioItems:l}},c0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>l0e(c,n)),...oK(r,e)],s=aK(o),a=s.length>1;return u0e(s,a,n),f0e(s),{stdioItems:s,isStdioArray:a}},l0e=(t,e)=>({type:NW(t,e),value:t,optionName:e}),u0e=(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(d0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},d0e=new Set(["ignore","ipc"]),f0e=t=>{for(let e of t)p0e(e)},p0e=({type:t,value:e,optionName:r})=>{if(LW(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(zW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},m0e=(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.`)},h0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(g0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw EI(i),o}},g0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>y0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},y0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},EI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},_0e=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 fK}from"node:fs";var mK,Mi,b0e,hK,pK,v0e,gK=y(()=>{an();av();$r();mK=(t,e)=>sv(v0e,t,e,!0),Mi=({type:t,optionName:e})=>{hK(e,ys[t])},b0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hK(t,`"${e}"`),{}),hK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:b0e},v0e={input:{...pK,fileUrl:({value:t})=>({contents:[vo(fK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(fK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pK,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,AI,pp=y(()=>{lI();ko=(t,{stripFinalNewline:e},r)=>AI(e,r)&&t!==void 0&&!Array.isArray(t)?Fl(t):t,AI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,OI,yK,_K,S0e,w0e,x0e,bK,$0e,TI,k0e,E0e,A0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:_K(e,n),OI=(t,e,r)=>r?t.flatMap(n=>yK(n,e)):yK(t,e),yK=(t,e)=>{let{transform:r,final:n}=_K(e,{});return[...r(t),...n()]},_K=(t,e)=>(e.previousChunks="",{transform:S0e.bind(void 0,e,t),final:x0e.bind(void 0,e)}),S0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=TI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=TI(n,r.slice(i+1))),t.previousChunks=n},w0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),x0e=function*({previousChunks:t}){t.length>0&&(yield t)},bK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:$0e.bind(void 0,n)},$0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?k0e:A0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},TI=(t,e)=>`${t}${e}`,k0e={windowsNewline:`\r +${t}`}});import Awe from"node:path";import K9 from"node:process";var J9,Hb,Twe,Owe,cI=y(()=>{J9=wt(RV(),1);MV();xb();np();WR();rI();nI();iI();oI();ja();aI();Tl();xo();Hb=(t,e,r)=>{r.cwd=Z9(r.cwd);let[n,i,o]=U9(t,e,r),{command:s,args:a,options:c}=J9.default._parse(n,i,o),l=bZ(c),u=Twe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=xR(u.shell),u.env=Owe(u),u.killSignal=XV(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&Awe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Twe=({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}),Owe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,lI=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 Rwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Iwe(t)}var Rwe,Iwe,Y9,Pwe,X9,Cwe,uI=y(()=>{Rwe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,Iwe=t=>t.at(-1)===Pwe?t.subarray(0,t.at(-2)===Cwe?-2:-1):t,Y9=` +`,Pwe=Y9.codePointAt(0),X9="\r",Cwe=X9.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 dI(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 fI(t,e){return dI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function Q9(){return this[mI].next()}function eW(t){return this[mI].return(t)}function hI({preventCancel:t=!1}={}){let e=this.getReader(),r=new pI(e,t),n=Object.create(Nwe);return n[mI]=r,n}var Dwe,pI,mI,Nwe,tW=y(()=>{Dwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),pI=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}}},mI=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eW,"name",{value:"return"});Nwe=Object.create(Dwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eW}})});var rW=y(()=>{});var nW=y(()=>{tW();rW()});var iW,jwe,Mwe,Fwe,cp,gI=y(()=>{Fa();nW();iW=t=>{if(Ma(t,{checkOpen:!1})&&cp.on!==void 0)return Mwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(jwe.call(t)==="[object ReadableStream]")return hI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:jwe}=Object.prototype,Mwe=async function*(t){let e=new AbortController,r={};Fwe(t,e,r);try{for await(let[n]of cp.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()}},Fwe=async(t,e,r)=>{try{await cp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},cp={}});var zl,Lwe,aW,oW,zwe,sW,ji,lp=y(()=>{gI();zl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iW(t),u=e();u.length=0;try{for await(let d of l){let f=zwe(d),p=r[f](d,u);aW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Lwe({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}},Lwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oW(c,e,i,o),new ji},oW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},zwe=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=sW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,up,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,up=()=>{},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,Bwe,e)}var Uwe,qwe,Hwe,Bwe,cW=y(()=>{lp();Wb();Uwe=()=>({contents:[]}),qwe=()=>1,Hwe=(t,{contents:e})=>(e.push(t),e),Bwe={init:Uwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:qwe,truncateChunk:up,addChunk:Hwe,getFinalChunk:up,finalize:Gb}});async function Jb(t,e){return zl(t,Qwe,e)}var Gwe,Zwe,Vwe,lW,uW,Wwe,Kwe,Jwe,Ywe,fW,dW,Xwe,pW,Qwe,mW=y(()=>{lp();Wb();Gwe=()=>({contents:new ArrayBuffer(0)}),Zwe=t=>Vwe.encode(t),Vwe=new TextEncoder,lW=t=>new Uint8Array(t),uW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Wwe=(t,e)=>t.slice(0,e),Kwe=(t,{contents:e,length:r},n)=>{let i=pW()?Ywe(e,n):Jwe(e,n);return new Uint8Array(i).set(t,r),i},Jwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Ywe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fW=t=>dW**Math.ceil(Math.log(t)/Math.log(dW)),dW=2,Xwe=({contents:t,length:e})=>pW()?t:t.slice(0,e),pW=()=>"resize"in ArrayBuffer.prototype,Qwe={init:Gwe,convertChunk:{string:Zwe,buffer:lW,arrayBuffer:lW,dataView:uW,typedArray:uW,others:Zb},getSize:Vb,truncateChunk:Wwe,addChunk:Kwe,getFinalChunk:up,finalize:Xwe}});async function Xb(t,e){return zl(t,ixe,e)}var exe,Yb,txe,rxe,nxe,ixe,hW=y(()=>{lp();Wb();exe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),txe=(t,{contents:e})=>e+t,rxe=(t,e)=>t.slice(0,e),nxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},ixe={init:exe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:txe,getFinalChunk:nxe,finalize:Gb}});var gW=y(()=>{cW();mW();hW();lp()});import{on as oxe}from"node:events";import{finished as sxe}from"node:stream/promises";var Qb=y(()=>{gI();gW();Object.assign(cp,{on:oxe,finished:sxe})});var yW,axe,_W,bW,cxe,vW,SW,ev,La=y(()=>{Qb();So();xo();yW=({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=axe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},axe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_W=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},bW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=cxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},cxe=(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}},vW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),SW=(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 lxe}from"node:util";var xW,uxe,dxe,fxe,pxe,mxe,wW,$W=y(()=>{uI();an();aI();lb();La();np();Da();xW=({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=uxe({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=fxe(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=>pxe(D)).join(` +`)].map(D=>Qf(Ll(mxe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:R,message:T}},uxe=({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=dxe(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?`${bW(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"},dxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",fxe=(t,e)=>{if(t instanceof ni)return;let r=zV(t)?t.originalMessage:String(t?.message??t),n=Qf(W9(r,e));return n===""?void 0:n},pxe=t=>typeof t=="string"?t:lxe(t),mxe=t=>Array.isArray(t)?t.map(e=>Ll(wW(e))).filter(Boolean).join(` +`):wW(t),wW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,Ul,dp,hxe,kW,gxe,fp=y(()=>{np();hb();Da();$W();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kW({command:t,escapedCommand:e,cwd:o,durationMs:CR(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})=>dp({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}),dp=({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}=gxe(l,u),{originalMessage:T,shortMessage:D,message:E}=xW({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=FV(t,E,x);return Object.assign(ae,hxe({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},hxe=({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})=>kW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:CR(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:[]}),kW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),gxe=(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 yxe(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(EW(t*1e3)%1e3),nanoseconds:Math.trunc(EW(t*1e6)%1e3)}}function _xe(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 yI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return yxe(t);break}case"bigint":return _xe(t)}throw new TypeError("Expected a finite number or bigint")}var EW,AW=y(()=>{EW=t=>Number.isFinite(t)?t:0});function _I(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+Sxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&bxe(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?" "+vxe(d,u):f;i.push(p)}},a=yI(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%wxe):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 bxe,vxe,Sxe,wxe,TW=y(()=>{AW();bxe=t=>t===0||t===0n,vxe=(t,e)=>e===1||e===1n?t:`${t}s`,Sxe=1e-7,wxe=24n*60n*60n*1000n});var OW,RW=y(()=>{Il();OW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IW,xxe,PW=y(()=>{TW();ps();Il();RW();IW=(t,e)=>{Ol(e)&&(OW(t,e),xxe(t,e))},xxe=(t,e)=>{let r=`(done in ${_I(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var ql,rv=y(()=>{PW();ql=(t,e,{reject:r})=>{if(IW(t,e),t.failed&&r)throw t;return t}});var NW,$xe,kxe,jW,MW,CW,Exe,bI,DW,za,FW,Axe,nv,LW,Txe,Oxe,vI,zW,Rxe,UW,iv,Ixe,SI,Pxe,Cxe,qW,Cn,ov,wI,HW,BW,ys,$r=y(()=>{Fa();bo();an();NW=(t,e)=>za(t)?"asyncGenerator":FW(t)?"generator":nv(t)?"fileUrl":Txe(t)?"filePath":Ixe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Pxe(t)?"asyncIterable":Cxe(t)?"iterable":SI(t)?jW({transform:t},e):Axe(t)?$xe(t,e):"native",$xe=(t,e)=>fI(t.transform,{checkOpen:!1})?kxe(t,e):SI(t.transform)?jW(t,e):Exe(t,e),kxe=(t,e)=>(MW(t,e,"Duplex stream"),"duplex"),jW=(t,e)=>(MW(t,e,"web TransformStream"),"webTransform"),MW=({final:t,binary:e,objectMode:r},n,i)=>{CW(t,`${n}.final`,i),CW(e,`${n}.binary`,i),bI(r,`${n}.objectMode`)},CW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Exe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(fI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(SI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return bI(r,`${i}.binary`),bI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},bI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DW=t=>za(t)||FW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Axe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",LW=t=>nv(t)&&t.protocol!=="file:",Txe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Oxe.has(e))&&vI(t.file),Oxe=new Set(["file","append"]),vI=t=>typeof t=="string",zW=(t,e)=>t==="native"&&typeof e=="string"&&!Rxe.has(e),Rxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Ixe=t=>UW(t)||iv(t),SI=t=>UW(t?.readable)&&iv(t?.writable),Pxe=t=>qW(t)&&typeof t[Symbol.asyncIterator]=="function",Cxe=t=>qW(t)&&typeof t[Symbol.iterator]=="function",qW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),wI=new Set(["fileUrl","filePath"]),HW=new Set([...wI,"webStream","nodeStream"]),BW=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 xI,Dxe,Nxe,GW,$I=y(()=>{$r();xI=(t,e,r,n)=>n==="output"?Dxe(t,e,r):Nxe(t,e,r),Dxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Nxe=(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}},GW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZW,jxe,Mxe,Fxe,Lxe,zxe,Uxe,VW=y(()=>{bo();ja();$r();$I();ZW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...jxe(t,e,r,n)],jxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Mxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Uxe(o,r)},Mxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Fxe({stdioItem:t,optionName:i}):e==="webTransform"?Lxe({stdioItem:t,index:r,newTransforms:n,direction:o}):zxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Fxe=({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}}},Lxe=({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}=xI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},zxe=({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}=xI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Uxe=(t,e)=>e==="input"?t.reverse():t});import kI from"node:process";var WW,qxe,Hxe,Hl,EI,KW,Bxe,Gxe,JW=y(()=>{Fa();$r();WW=(t,e,r)=>{let n=t.map(i=>qxe(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)??Gxe},qxe=({type:t,value:e},r)=>Hxe[r]??KW[t](e),Hxe=["input","output","output"],Hl=()=>{},EI=()=>"input",KW={generator:Hl,asyncGenerator:Hl,fileUrl:Hl,filePath:Hl,iterable:EI,asyncIterable:EI,uint8Array:EI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?dI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Hl,duplex:Hl,native(t){let e=Bxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return KW.nodeStream(t)}},Bxe=t=>{if([0,kI.stdin].includes(t))return"input";if([1,2,kI.stdout,kI.stderr].includes(t))return"output"},Gxe="output"});var YW,XW=y(()=>{YW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QW,Zxe,Vxe,eK,Wxe,Kxe,tK=y(()=>{So();XW();ps();QW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Zxe(t,n).map((a,c)=>eK(a,c));return o?Wxe(s,r,i):YW(s,e)},Zxe=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(Vxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},Vxe=t=>Pn.some(e=>t[e]!==void 0),eK=(t,e)=>Array.isArray(t)?t.map(r=>eK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),Wxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Rl(r,i)&&Kxe(n)?"ignore":n),Kxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Jxe}from"node:fs";import Yxe from"node:tty";var nK,Xxe,Qxe,e0e,t0e,rK,iK=y(()=>{Fa();So();an();hs();nK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Xxe({stdioItem:t,fdNumber:n,direction:i}):t0e({stdioItem:t,fdNumber:n}),Xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Qxe({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},Qxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=e0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Yxe.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(Jxe(i)),optionName:e}}},e0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},t0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rK=(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 oK,r0e,n0e,i0e,o0e,sK=y(()=>{Fa();an();$r();oK=({input:t,inputFile:e},r)=>r===0?[...r0e(t),...i0e(e)]:[],r0e=t=>t===void 0?[]:[{type:n0e(t),value:t,optionName:"input"}],n0e=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.")},i0e=t=>t===void 0?[]:[{...o0e(t),optionName:"inputFile"}],o0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(vI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aK,cK,s0e,a0e,lK,c0e,l0e,uK,dK=y(()=>{$r();aK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=s0e(i,t);if(s.length!==0){if(o){a0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(HW.has(t))return lK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});BW.has(t)&&l0e({otherStdioItems:s,type:t,value:e,optionName:r})}},s0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),a0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{wI.has(e)&&lK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>c0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uK(s,n,e),i==="output"?o[0].stream:void 0},c0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,l0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uK(i,n,e)},uK=(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,u0e,d0e,f0e,p0e,m0e,h0e,g0e,y0e,_0e,b0e,v0e,AI,S0e,av=y(()=>{So();VW();$I();$r();JW();tK();iK();sK();dK();sv=(t,e,r,n)=>{let o=QW(e,r,n).map((a,c)=>u0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=_0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>S0e(a)),s},u0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=d0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WW(o,e,i),c=o.map(d=>nK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZW(c,i,a,r),u=GW(l,a);return y0e(l,u),{direction:a,objectMode:u,stdioItems:l}},d0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>f0e(c,n)),...oK(r,e)],s=aK(o),a=s.length>1;return p0e(s,a,n),h0e(s),{stdioItems:s,isStdioArray:a}},f0e=(t,e)=>({type:NW(t,e),value:t,optionName:e}),p0e=(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(m0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},m0e=new Set(["ignore","ipc"]),h0e=t=>{for(let e of t)g0e(e)},g0e=({type:t,value:e,optionName:r})=>{if(LW(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(zW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},y0e=(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.`)},_0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(b0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw AI(i),o}},b0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>v0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},v0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},AI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},S0e=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 fK}from"node:fs";var mK,Mi,w0e,hK,pK,x0e,gK=y(()=>{an();av();$r();mK=(t,e)=>sv(x0e,t,e,!0),Mi=({type:t,optionName:e})=>{hK(e,ys[t])},w0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hK(t,`"${e}"`),{}),hK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:w0e},x0e={input:{...pK,fileUrl:({value:t})=>({contents:[vo(fK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(fK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pK,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,TI,pp=y(()=>{uI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?Ll(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,RI,yK,_K,$0e,k0e,E0e,bK,A0e,OI,T0e,O0e,R0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:_K(e,n),RI=(t,e,r)=>r?t.flatMap(n=>yK(n,e)):yK(t,e),yK=(t,e)=>{let{transform:r,final:n}=_K(e,{});return[...r(t),...n()]},_K=(t,e)=>(e.previousChunks="",{transform:$0e.bind(void 0,e,t),final:E0e.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=OI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=OI(n,r.slice(i+1))),t.previousChunks=n},k0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),E0e=function*({previousChunks:t}){t.length>0&&(yield t)},bK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:A0e.bind(void 0,n)},A0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?T0e:R0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},OI=(t,e)=>`${t}${e}`,T0e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:TI},E0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},A0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:E0e}});import{Buffer as T0e}from"node:buffer";var vK,O0e,SK,R0e,I0e,wK,xK=y(()=>{an();vK=(t,e)=>t?void 0:O0e.bind(void 0,e),O0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!T0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SK=(t,e)=>t?R0e.bind(void 0,e):I0e.bind(void 0,e),R0e=function*(t,e){wK(t,e),yield e},I0e=function*(t,e){if(wK(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},wK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:OI},O0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},R0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:O0e}});import{Buffer as I0e}from"node:buffer";var vK,P0e,SK,C0e,D0e,wK,xK=y(()=>{an();vK=(t,e)=>t?void 0:P0e.bind(void 0,e),P0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!I0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SK=(t,e)=>t?C0e.bind(void 0,e):D0e.bind(void 0,e),C0e=function*(t,e){wK(t,e),yield e},D0e=function*(t,e){if(wK(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},wK=(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 P0e}from"node:buffer";import{StringDecoder as C0e}from"node:string_decoder";var uv,D0e,N0e,j0e,RI=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:D0e.bind(void 0,new TextEncoder)};let n=new C0e(e);return{transform:N0e.bind(void 0,n),final:j0e.bind(void 0,n)}},D0e=function*(t,e){P0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},N0e=function*(t,e){yield qt(e)?t.write(e):e},j0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $K}from"node:util";var II,dv,kK,M0e,EK,F0e,AK=y(()=>{II=$K(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=F0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},kK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*M0e(r,Number(e),t)},M0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},EK=$K(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),F0e=function*(t){yield t}});var PI,TK,Ua,mp,L0e,z0e,CI=y(()=>{PI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...mp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=z0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},mp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*L0e(r,Number(e),t)},L0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},z0e=function*(t){yield t}});import{Transform as U0e,getDefaultHighWaterMark as OK}from"node:stream";var DI,fv,RK,pv=y(()=>{$r();lv();xK();RI();AK();CI();DI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RK(t,s,o),l=za(e),u=za(r),d=l?II.bind(void 0,dv,a):PI.bind(void 0,Ua),f=l||u?II.bind(void 0,kK,a):PI.bind(void 0,mp),p=l||u?EK.bind(void 0,a):void 0;return{stream:new U0e({writableObjectMode:n,writableHighWaterMark:OK(n),readableObjectMode:i,readableHighWaterMark:OK(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=RK(s,r,a);t=TK(c,t)}return t},RK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:SK(i,a)},bK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IK,q0e,H0e,B0e,G0e,PK=y(()=>{pv();an();$r();IK=(t,e)=>{for(let r of q0e(t))H0e(t,r,e)},q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),H0e=(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=>B0e(a,n));r.input=Xf(s)},B0e=(t,e)=>{let r=fv(t,e,"utf8",!0);return G0e(r),Xf(r)},G0e=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,Z0e,V0e,CK,DK,W0e,NK,NI=y(()=>{ja();$r();Rl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Ol(r,n)&&!cn.has(e)&&Z0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&V0e.has(o))||t.every(({type:i})=>Cn.has(i))),Z0e=t=>t===1||t===2,V0e=new Set(["pipe","overlapped"]),CK=async(t,e,r,n)=>{for await(let i of t)W0e(e)||NK(i,r,n)},DK=(t,e,r)=>{for(let n of t)NK(n,e,r)},W0e=t=>t._readableState.pipes.length>0,NK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as K0e,appendFileSync as J0e}from"node:fs";var jK,Y0e,X0e,Q0e,e$e,t$e,MK=y(()=>{NI();pv();lv();an();$r();La();jK=({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)=>Y0e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},Y0e=({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=SW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=X0e([p],m,c,n),{serializedResult:b,finalResult:_=b}=Q0e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});e$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&&t$e(b,m,i),S}catch(x){return n.error=x,S}},X0e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},Q0e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Xf(t)};let s=dZ(t,r);return n[o]?{serializedResult:s,finalResult:OI(s,!i[o],e)}:{serializedResult:s}},e$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=OI(t,!1,s);try{DK(a,e,n)}catch(c){r.error??=c}},t$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)?J0e(n,t):(r.add(o),K0e(n,t))}}});var FK,LK=y(()=>{an();pp();FK=([,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)?$R([t,e]):`${t}${e}`}});import{once as jI}from"node:events";var zK,r$e,UK,qK,n$e,MI,FI=y(()=>{Da();zK=async(t,e)=>{let[r,n]=await r$e(t);return e.isForcefullyTerminated??=!1,[r,n]},r$e=async t=>{let[e,r]=await Promise.allSettled([jI(t,"spawn"),jI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UK(t):r.value},UK=async t=>{try{return await jI(t,"exit")}catch{return UK(t)}},qK=async t=>{let[e,r]=await t;if(!n$e(e,r)&&MI(e,r))throw new ni;return[e,r]},n$e=(t,e)=>t===void 0&&e===void 0,MI=(t,e)=>t!==0||e!==null});var HK,i$e,BK=y(()=>{Da();La();FI();HK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=i$e(t,e,r),s=o?.code==="ETIMEDOUT",a=vW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},i$e=(t,e,r)=>t!==void 0?t:MI(e,r)?new ni:void 0});import{spawnSync as o$e}from"node:child_process";var GK,s$e,a$e,c$e,hv,l$e,u$e,d$e,f$e,ZK=y(()=>{CR();aI();cI();fp();rv();gK();pp();PK();MK();La();LK();BK();GK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=s$e(t,e,r),d=l$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Ul(d,c,l)},s$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=a$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);c$e(u);let d=mK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},a$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,c$e=({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.`)},l$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=u$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}=HK(c,r),{output:m,error:h=l}=jK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(FK(m,r),r,"all");return f$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},u$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IK(o,r);let a=d$e(r);return o$e(...Bb(t,e,a))}catch(a){return zl({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},d$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),f$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?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):dp({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 LI,on as p$e}from"node:events";var VK,m$e,h$e,g$e,y$e,WK=y(()=>{Nl();sp();op();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Cl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),m$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),m$e=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([h$e(o,n,s),g$e(o,r,s),y$e(o,r,s)])}catch(a){throw Dl(t),a}finally{s.abort(),Rb(e,i)}},h$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await LI(t,"message",{signal:r});return n}for await(let[n]of p$e(t,"message",{signal:r}))if(e(n))return n},g$e=async(t,e,{signal:r})=>{await LI(t,"disconnect",{signal:r}),o9(e)},y$e=async(t,e,{signal:r})=>{let[n]=await LI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as JK,on as _$e}from"node:events";var YK,zI,b$e,v$e,S$e,KK,UI=y(()=>{Nl();sp();op();YK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>zI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),zI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Cl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Ob(e,o);let s=gs(t,e,r),a=new AbortController,c={};return b$e(t,s,a),v$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),S$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},b$e=async(t,e,r)=>{try{await JK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},v$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},S$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 _$e(r,"message",{signal:o.signal}))KK(s),yield c}catch{KK(s)}finally{o.abort(),Rb(e,a),n||Dl(t),i&&await t}},KK=({error:t})=>{if(t)throw t}});import XK from"node:process";var QK,e3,t3,qI=y(()=>{Ub();WK();UI();Db();QK=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XK,e=!0,r=XK.channel!==void 0;return{...t3(t,e,r),getCancelSignal:C9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},t3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as w$e}from"node:child_process";import{PassThrough as x$e,Readable as $$e,Writable as k$e,Duplex as E$e}from"node:stream";var r3,A$e,hp,T$e,O$e,R$e,I$e,n3=y(()=>{av();fp();rv();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{EI(n);let a=new w$e;A$e(a,n),Object.assign(a,{readable:T$e,writable:O$e,duplex:R$e});let c=zl({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=I$e(c,s,i);return{subprocess:a,promise:l}},A$e=(t,e)=>{let r=hp(),n=hp(),i=hp(),o=Array.from({length:e.length-3},hp),s=hp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},hp=()=>{let t=new x$e;return t.end(),t},T$e=()=>new $$e({read(){}}),O$e=()=>new k$e({write(){}}),R$e=()=>new E$e({read(){},write(){}}),I$e=async(t,e,r)=>Ul(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as P$e}from"node:buffer";import{Readable as gp,Writable as C$e,Duplex as D$e}from"node:stream";var a3,yp,s3,N$e,c3=y(()=>{pv();av();$r();a3=(t,e)=>sv(N$e,t,e,!1),yp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},s3={fileNumber:yp,generator:DI,asyncGenerator:DI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:D$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},N$e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:gp.fromWeb(t)}),iterable:({value:t})=>({stream:gp.from(t)}),asyncIterable:({value:t})=>({stream:gp.from(t)}),string:({value:t})=>({stream:gp.from(t)}),uint8Array:({value:t})=>({stream:gp.from(P$e.from(t))})},output:{...s3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t,append:e}})=>({stream:o3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:C$e.fromWeb(t)}),iterable:yp,asyncIterable:yp,string:yp,uint8Array:yp}}});import{on as j$e,once as l3}from"node:events";import{PassThrough as M$e,getDefaultHighWaterMark as F$e}from"node:stream";import{finished as f3}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)BI(i);let e=t.some(({readableObjectMode:i})=>i),r=L$e(t,e),n=new HI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var L$e,HI,z$e,U$e,q$e,BI,H$e,B$e,G$e,Z$e,V$e,p3,m3,GI,h3,W$e,gv,u3,d3,yv=y(()=>{L$e=(t,e)=>{if(t.length===0)return F$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},HI=class extends M$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(BI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=z$e(this,this.#t,this.#o);let r=H$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(BI(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)}},z$e=async(t,e,r)=>{gv(t,u3);let n=new AbortController;try{await Promise.race([U$e(t,n),q$e(t,e,r,n)])}finally{n.abort(),gv(t,-u3)}},U$e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},q$e=async(t,e,r,{signal:n})=>{for await(let[i]of j$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},BI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},H$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,d3);let a=new AbortController;try{await Promise.race([B$e(o,e,a),G$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),Z$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?GI(t):V$e(t))},B$e=async(t,e,{signal:r})=>{try{await t,r.aborted||GI(e)}catch(n){r.aborted||p3(e,n)}},G$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await f3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;m3(s)?i.add(e):h3(t,s)}},Z$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await l3(t,i,{signal:o}),!t.readable)return l3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},V$e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?GI(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",GI=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",W$e),t.destroy(e))},W$e=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},u3=2,d3=1});import{finished as g3}from"node:stream/promises";var Hl,K$e,ZI,J$e,VI,_v=y(()=>{So();Hl=(t,e)=>{t.pipe(e),K$e(t,e),J$e(t,e)},K$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}ZI(e)}},ZI=t=>{t.writable&&t.end()},J$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}VI(t)}},VI=t=>{t.readable&&t.destroy()}});var y3,Y$e,X$e,Q$e,eke,tke,_3=y(()=>{yv();So();Tb();$r();_v();y3=(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})=>Cn.has(c)))Y$e(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))Q$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)}},Y$e=(t,e,r,n)=>{r==="output"?Hl(t.stdio[n],e):Hl(e,t.stdio[n]);let i=X$e[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},X$e=["stdin","stdout","stderr"],Q$e=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;eke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},eke=(t,{signal:e})=>{ri(t)&&Na(t,tke,e)},tke=2});var Ha,b3=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 bv,WI,KI,rke,JI,vv,nke,YI,XI,QI,v3,Bct,Gct,S3=y(()=>{b3();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",WI=Symbol.for("signal-exit emitter"),KI=globalThis,rke=Object.defineProperty.bind(Object),JI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(KI[WI])return KI[WI];rke(KI,WI,{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{},nke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),YI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},XI=class extends vv{#t=QI.platform==="win32"?"SIGINT":"SIGHUP";#r=new JI;#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(!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 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 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)}},QI=globalThis.process,{onExit:v3,load:Bct,unload:Gct}=nke(bv(QI)?new XI(QI):new YI)});import{addAbortListener as ike}from"node:events";var w3,x3=y(()=>{S3();w3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=v3(()=>{t.kill()});ike(n,()=>{i()})}});var k3,oke,ske,$3,ake,E3=y(()=>{xR();hb();hs();Al();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=oke(r,n,i),{sourceStream:d,sourceError:f}=ake(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}},oke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=ske(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},ske=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||SR(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($3)(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}`)},$3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),ake=(t,e)=>{try{return{sourceStream:Ml(t,e)}}catch(r){return{sourceError:r}}}});var T3,cke,eP,A3,tP=y(()=>{fp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=cke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw eP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},cke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return VI(t),n;if(e!==void 0)return ZI(r),e},eP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>zl({error:t,command:A3,escapedCommand:A3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),A3="source.pipe(destination)"});var O3,R3=y(()=>{O3=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 lke}from"node:stream/promises";var I3,uke,dke,fke,Sv,pke,mke,P3=y(()=>{yv();Tb();_v();I3=(t,e,r)=>{let n=Sv.has(e)?dke(t,e):uke(t,e);return Na(t,pke,r.signal),Na(e,mke,r.signal),fke(e),n},uke=(t,e)=>{let r=qa([t]);return Hl(r,e),Sv.set(e,r),r},dke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},fke=async t=>{try{await lke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,pke=2,mke=1});import{aborted as hke}from"node:util";var C3,gke,D3=y(()=>{tP();C3=(t,e)=>t===void 0?[]:[gke(t,e)],gke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await hke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw eP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,yke,_ke,N3=y(()=>{bo();E3();tP();R3();P3();D3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=yke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},yke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=_ke(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=I3(e,o,d);return await Promise.race([O3(u),...C3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},_ke=(t,e)=>Promise.allSettled([t,e])});import{on as bke}from"node:events";import{getDefaultHighWaterMark as vke}from"node:stream";var xv,Ske,rP,wke,M3,nP,j3,xke,$ke,$v=y(()=>{RI();lv();CI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Ske(e,s),M3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Ske=async(t,e)=>{try{await t}catch{}finally{e.abort()}},rP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;wke(e,s,t);let a=t.readableObjectMode&&!o;return M3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},wke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},M3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=bke(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return xke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},nP=vke(!0),j3=nP,xke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=$ke({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*mp(a)}},$ke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as kke}from"node:timers/promises";var F3,Eke,Ake,Tke,iP,L3,oP=y(()=>{Qb();an();NI();$v();La();pp();F3=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=Eke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Ake(t),d]);return}let f=AI(c,r),p=rP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Tke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Eke=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=rP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CK(a,t,r,o)},Ake=async t=>{await kke(),t.readableFlowing===null&&t.resume()},Tke=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 L3(yW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},iP=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lZ(t)?new Uint8Array(t):t});import{finished as Oke}from"node:stream/promises";var _p,Rke,Ike,Pke,Cke,Dke,sP,kv,z3,Ev=y(()=>{_p=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Rke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Oke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Cke(a,e,r,n)}finally{s.abort()}},Rke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Ike(t,r,n),n},Ike=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Pke(e,r),n.call(t,...i)}},Pke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Cke=(t,e,r,n)=>{if(!Dke(t,e,r,n))throw t},Dke=(t,e,r,n=!0)=>r.propagating?z3(t)||kv(t):(r.propagating=!0,sP(r,e)===n?z3(t):kv(t)),sP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,aP,cP=y(()=>{oP();Ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>aP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),aP=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=_p(t,e,l);if(sP(l,e)){await u;return}let[d]=await Promise.all([F3({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 q3,H3,Nke,jke,lP=y(()=>{yv();cP();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>aP({...Nke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:jke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Nke=({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}},jke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var B3,G3,Z3=y(()=>{Rl();ps();B3=t=>Ol(t,"ipc"),G3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{La();Z3();xo();UI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=B3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of zI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_W(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Mke}from"node:events";var J3,Fke,Lke,zke,Y3=y(()=>{Fa();rI();VR();tI();So();$r();oP();K3();iI();lP();cP();FI();Ev();J3=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 _=zK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=U3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Fke(h,t,S),D=Lke(m,S);try{return await Promise.race([Promise.all([{},qK(_),Promise.all(x),w,A,H9(t,d),...T,...D]),g,zke(t,b),...F9(t,o,f,b),...i9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...j9({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=>iP(ae))),iP(w),W3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Fke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_p(n,i,r)),Lke=(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})=>_p(s,n,e,{isSameDirection:Cn.has(i),stopOnExit:i==="native"}))),zke=async(t,{signal:e})=>{let[r]=await Mke(t,"error",{signal:e});throw r}});var X3,bp,Bl,Av=y(()=>{jl();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),bp=(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 Q3}from"node:stream/promises";var uP,eJ,dP,fP,Tv,Ov,pP=y(()=>{Ev();uP=async t=>{if(t!==void 0)try{await dP(t)}catch{}},eJ=async t=>{if(t!==void 0)try{await fP(t)}catch{}},dP=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},fP=async t=>{await Q3(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 Uke}from"node:stream";import{callbackify as qke}from"node:util";var tJ,mP,hP,gP,Hke,yP,_P,rJ,bP=y(()=>{ja();hs();$v();jl();Av();pP();tJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=mP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=hP(a,s),{read:f,onStdoutDataDone:p}=gP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Uke({read:f,destroy:qke(_P.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return yP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},mP=(t,e,r)=>{let n=Ml(t,e),i=bp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},hP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:nP},gP=({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(){Hke(this,s,o)},onStdoutDataDone:o}},Hke=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},yP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await fP(t),await n,await uP(i),await e,r.readable&&r.push(null)}catch(o){await uP(i),rJ(r,o)}},_P=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Bl(r,e)&&(rJ(t,n),await Tv(e,n))},rJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as Bke}from"node:stream";import{callbackify as nJ}from"node:util";var iJ,vP,SP,Gke,Zke,wP,xP,oJ,$P=y(()=>{hs();Av();pP();iJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=vP(t,r,e),s=new Bke({...SP(n,t,i),destroy:nJ(xP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return wP(n,s),s},vP=(t,e,r)=>{let n=Ab(t,e),i=bp(r,n,"writableFinal"),o=bp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},SP=(t,e,r)=>({write:Gke.bind(void 0,t),final:nJ(Zke.bind(void 0,t,e,r))}),Gke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Zke=async(t,e,r)=>{await Bl(r,e)&&(t.writable&&t.end(),await e)},wP=async(t,e,r)=>{try{await dP(t),e.writable&&e.end()}catch(n){await eJ(r),oJ(e,n)}},xP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Bl(r,e),await Bl(n,e)&&(oJ(t,i),await Tv(e,i))},oJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as Vke}from"node:stream";import{callbackify as Wke}from"node:util";var sJ,Kke,aJ=y(()=>{ja();bP();$P();sJ=({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}=mP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=vP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=hP(c,a),{read:g,onStdoutDataDone:b}=gP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Vke({read:g,...SP(u,t,d),destroy:Wke(Kke.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 yP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),wP(u,_,c),_},Kke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([_P({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),xP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var kP,Jke,cJ=y(()=>{ja();hs();$v();kP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ml(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return Jke(a,s,t)},Jke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lJ,uJ=y(()=>{Av();bP();$P();aJ();cJ();lJ=(t,{encoding:e})=>{let r=X3();t.readable=tJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=kP.bind(void 0,t,e),t[Symbol.asyncIterator]=kP.bind(void 0,t,e,{})}});var dJ,Yke,Xke,fJ=y(()=>{dJ=(t,e)=>{for(let[r,n]of Xke){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},Yke=(async()=>{})().constructor.prototype,Xke=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(Yke,t)])});import{setMaxListeners as Qke}from"node:events";import{spawn as eEe}from"node:child_process";var pJ,tEe,rEe,nEe,iEe,oEe,mJ=y(()=>{Qb();CR();aI();hs();cI();qI();fp();rv();n3();c3();pp();_3();xb();x3();N3();lP();Y3();uJ();jl();fJ();pJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=tEe(t,e,r),{subprocess:f,promise:p}=nEe({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}),dJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},tEe=(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=rEe(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},rEe=({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}},nEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=eEe(...Bb(t,e,r))}catch(m){return r3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;Qke(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Di();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lJ(c,r),QK(c,r);let p=iEe({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}},iEe=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 J3({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=oEe({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)},oEe=({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?dp({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,sEe,aEe,hJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,sEe(n,t[n],i)]));return{...t,...r}},sEe=(t,e,r)=>aEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,aEe=new Set(["env",...TR])});var _s,cEe,lEe,gJ=y(()=>{bo();xR();yZ();ZK();mJ();hJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>cEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},cEe=({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}=lEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GK(a,c,l):pJ(a,c,l,i)},lEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hZ(e)?gZ(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 yJ,_J,bJ,uEe,dEe,vJ=y(()=>{yJ=({file:t,commandArguments:e})=>bJ(t,e),_J=({file:t,commandArguments:e})=>({...bJ(t,e),isSync:!0}),bJ=(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]=uEe(t);return{file:r,commandArguments:n}},uEe=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(dEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},dEe=/ +/g});var SJ,wJ,fEe,xJ,pEe,$J,kJ=y(()=>{SJ=(t,e,r)=>{t.sync=e(fEe,r),t.s=t.sync},wJ=({options:t})=>xJ(t),fEe=({options:t})=>({...xJ(t),isSync:!0}),xJ=t=>({options:{...pEe(t),...t}}),pEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$J={preferLocal:!0}});var Ddt,Ke,Ndt,jdt,Mdt,Fdt,Ldt,zdt,Udt,qdt,zr=y(()=>{gJ();vJ();nI();kJ();qI();Ddt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),Ndt=_s(yJ),jdt=_s(_J),Mdt=_s(z9),Fdt=_s(wJ,{},$J,SJ),{sendMessage:Ldt,getOneMessage:zdt,getEachMessage:Udt,getCancelSignal:qdt}=e3()});import{existsSync as Iv,statSync as mEe}from"node:fs";import{dirname as EP,extname as hEe,isAbsolute as EJ,join as AP,relative as TP,resolve as Pv,sep as gEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function yEe(t){return(Iv(AP(t,"build.gradle.kts"))||Iv(AP(t,"build.gradle")))&&Iv(AP(t,"gradle.properties"))}function _Ee(t,e){let n=TP(t,e).split(gEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function bEe(t,e){let r=Pv(t,e),n=r;Iv(r)?mEe(r).isFile()&&(n=EP(r)):hEe(r)!==""&&(n=EP(r));let i=TP(t,n);if(i.startsWith("..")||EJ(i))return null;let o=n;for(;;){if(yEe(o))return o;if(Pv(o)===Pv(t))return null;let s=EP(o);if(s===o)return null;let a=TP(t,s);if(a.startsWith("..")||EJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=bEe(r,o);if(!s){i.push(o);continue}let a=_Ee(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 RP,readFileSync as vEe}from"node:fs";import{join as Gl}from"node:path";function Zl(t="."){let e=Gl(t,".cladding","config.yaml");if(!RP(e))return OP;try{let n=(0,AJ.parse)(vEe(e,"utf8"))?.gate;if(!n)return OP;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 SEe){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 OP}}function TJ(t="."){let e=Zl(t).testReport,r=e?[e,...IP]:IP;return[...new Set(r.map(n=>Gl(t,n)))]}function OJ(t="."){let e=Zl(t).testReport;if(e){let r=Gl(t,e);return RP(r)?r:null}return IP.map(r=>Gl(t,r)).find(r=>RP(r))??null}function RJ(t,e){let r=[],n=!1;for(let i of t){let o=wEe.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 AJ,SEe,OP,IP,wEe,vp=y(()=>{"use strict";AJ=wt(tr(),1);Nv();SEe=["type","lint","test","coverage"],OP={scope:"feature"},IP=["test-report.junit.xml",Gl("coverage","junit.xml"),Gl(".cladding","test-report.junit.xml")];wEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as CP,readFileSync as IJ,readdirSync as xEe,statSync as $Ee}from"node:fs";import{join as jv}from"node:path";function jP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(CP(r))try{if(PJ.test(IJ(r,"utf8")))return!0}catch{}}return!1}function CJ(t){try{return CP(t)&&PJ.test(IJ(t,"utf8"))}catch{return!1}}function DJ(t,e=0){if(e>4||!CP(t))return!1;let r;try{r=xEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=$Ee(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CJ(i))return!0}return!1}function AEe(t){if(jP(t))return!0;for(let e of kEe)if(CJ(jv(t,e)))return!0;for(let e of EEe)if(DJ(jv(t,e)))return!0;return!1}function NJ(t="."){let e=Zl(t).coverage;return e||(AEe(t)?"kover":"jacoco")}function jJ(t="."){return DP[NJ(t)]}function MJ(t="."){return PP[NJ(t)]}var DP,PP,NP,PJ,kEe,EEe,Mv=y(()=>{"use strict";vp();DP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},PP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},NP=[PP.kover,PP.jacoco],PJ=/kover/i;kEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],EEe=["buildSrc","build-logic"]});import{existsSync as wp,readFileSync as FP,readdirSync as LJ,statSync as TEe}from"node:fs";import{dirname as OEe,join as kr,resolve as REe}from"node:path";import Vl from"node:process";function LP(t){return wp(kr(t,"gradlew"))?"./gradlew":"gradle"}function IEe(t){let e=LP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function PEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(FP(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 DEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function MEe(t,e){for(let r of e)if(wp(kr(t,r)))return r}function FEe(t,e){try{return LJ(t).find(n=>n.endsWith(e))}catch{return}}function qEe(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=REe(t);;){e.push(kr(o,".madgerc"));let s=OEe(o);if(s===o)break;o=s}let i=Vl.env.MADGE_config??Vl.env.madge_config;return i&&e.push(i),e}function HEe(){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 zJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function GEe(t){try{return TEe(t).isFile()}catch{return!1}}function ZEe(t){let e;try{e=FP(t,"utf8")}catch{return!0}try{return zJ(JSON.parse(e).excludeRegExp)}catch{return BEe.test(e)}}function VEe(t,e){let r=e.madge;return r&&typeof r=="object"&&zJ(r.excludeRegExp)||HEe()?!0:qEe(t).some(n=>GEe(n)&&ZEe(n))}function WEe(t){try{return JSON.parse(FP(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 FJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function KEe(t,e,r){if(VEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",UEe),{...e,args:n}}function JEe(t,e,r){if(Sp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of LEe)if(n.configs.some(i=>wp(kr(t,i))))return n.gate;if(zEe.some(n=>wp(kr(t,n)))||r.eslintConfig!==void 0)return e}function XEe(t,e){return YEe.some(r=>wp(kr(t,r)))?!0:e.jest!==void 0}function QEe(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 MP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function eAe(t,e){let r=WEe(t),n=e.lint?JEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:KEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:MP(i,"lint"),s=Sp(r,"test"),a=s?QEe(s):void 0;return s&&!a?(o=MP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...Sp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&XEe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!Sp(r,"coverage")&&!FJ(r,"@vitest/coverage-v8")&&!FJ(r,"@vitest/coverage-istanbul")?o=MP(o,"coverage"):a==="vitest"&&Sp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of NEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=FEe(t,o):r=MEe(t,[o]),r)break;if(!r||e.requiresSource&&!DEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?eAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return jEe}var Fi,CEe,NEe,jEe,LEe,zEe,UEe,BEe,YEe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];CEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);NEe=[{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:IEe},{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:PEe}],jEe={language:"unknown",manifest:"",gates:{}};LEe=[{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"]}}],zEe=["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"],UEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";BEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;YEe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as tAe,readFileSync as rAe}from"node:fs";import{join as nAe}from"node:path";function Ba(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(` + if (condition) { yield value; }`)}});import{Buffer as N0e}from"node:buffer";import{StringDecoder as j0e}from"node:string_decoder";var uv,M0e,F0e,L0e,II=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:M0e.bind(void 0,new TextEncoder)};let n=new j0e(e);return{transform:F0e.bind(void 0,n),final:L0e.bind(void 0,n)}},M0e=function*(t,e){N0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},F0e=function*(t,e){yield qt(e)?t.write(e):e},L0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $K}from"node:util";var PI,dv,kK,z0e,EK,U0e,AK=y(()=>{PI=$K(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=U0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},kK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*z0e(r,Number(e),t)},z0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},EK=$K(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),U0e=function*(t){yield t}});var CI,TK,Ua,mp,q0e,H0e,DI=y(()=>{CI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...mp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=H0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},mp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*q0e(r,Number(e),t)},q0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},H0e=function*(t){yield t}});import{Transform as B0e,getDefaultHighWaterMark as OK}from"node:stream";var NI,fv,RK,pv=y(()=>{$r();lv();xK();II();AK();DI();NI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RK(t,s,o),l=za(e),u=za(r),d=l?PI.bind(void 0,dv,a):CI.bind(void 0,Ua),f=l||u?PI.bind(void 0,kK,a):CI.bind(void 0,mp),p=l||u?EK.bind(void 0,a):void 0;return{stream:new B0e({writableObjectMode:n,writableHighWaterMark:OK(n),readableObjectMode:i,readableHighWaterMark:OK(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=RK(s,r,a);t=TK(c,t)}return t},RK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:SK(i,a)},bK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IK,G0e,Z0e,V0e,W0e,PK=y(()=>{pv();an();$r();IK=(t,e)=>{for(let r of G0e(t))Z0e(t,r,e)},G0e=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=>V0e(a,n));r.input=Xf(s)},V0e=(t,e)=>{let r=fv(t,e,"utf8",!0);return W0e(r),Xf(r)},W0e=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,K0e,J0e,CK,DK,Y0e,NK,jI=y(()=>{ja();$r();Il();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Rl(r,n)&&!cn.has(e)&&K0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&J0e.has(o))||t.every(({type:i})=>Cn.has(i))),K0e=t=>t===1||t===2,J0e=new Set(["pipe","overlapped"]),CK=async(t,e,r,n)=>{for await(let i of t)Y0e(e)||NK(i,r,n)},DK=(t,e,r)=>{for(let n of t)NK(n,e,r)},Y0e=t=>t._readableState.pipes.length>0,NK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as X0e,appendFileSync as Q0e}from"node:fs";var jK,e$e,t$e,r$e,n$e,i$e,MK=y(()=>{jI();pv();lv();an();$r();La();jK=({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)=>e$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},e$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=SW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=t$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=r$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});n$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&&i$e(b,m,i),S}catch(x){return n.error=x,S}},t$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},r$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Xf(t)};let s=dZ(t,r);return n[o]?{serializedResult:s,finalResult:RI(s,!i[o],e)}:{serializedResult:s}},n$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=RI(t,!1,s);try{DK(a,e,n)}catch(c){r.error??=c}},i$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)?Q0e(n,t):(r.add(o),X0e(n,t))}}});var FK,LK=y(()=>{an();pp();FK=([,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)?kR([t,e]):`${t}${e}`}});import{once as MI}from"node:events";var zK,o$e,UK,qK,s$e,FI,LI=y(()=>{Da();zK=async(t,e)=>{let[r,n]=await o$e(t);return e.isForcefullyTerminated??=!1,[r,n]},o$e=async t=>{let[e,r]=await Promise.allSettled([MI(t,"spawn"),MI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UK(t):r.value},UK=async t=>{try{return await MI(t,"exit")}catch{return UK(t)}},qK=async t=>{let[e,r]=await t;if(!s$e(e,r)&&FI(e,r))throw new ni;return[e,r]},s$e=(t,e)=>t===void 0&&e===void 0,FI=(t,e)=>t!==0||e!==null});var HK,a$e,BK=y(()=>{Da();La();LI();HK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=a$e(t,e,r),s=o?.code==="ETIMEDOUT",a=vW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},a$e=(t,e,r)=>t!==void 0?t:FI(e,r)?new ni:void 0});import{spawnSync as c$e}from"node:child_process";var GK,l$e,u$e,d$e,hv,f$e,p$e,m$e,h$e,ZK=y(()=>{DR();cI();lI();fp();rv();gK();pp();PK();MK();La();LK();BK();GK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=l$e(t,e,r),d=f$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return ql(d,c,l)},l$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=u$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);d$e(u);let d=mK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},u$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,d$e=({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.`)},f$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=p$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}=HK(c,r),{output:m,error:h=l}=jK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(FK(m,r),r,"all");return h$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},p$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IK(o,r);let a=m$e(r);return c$e(...Bb(t,e,a))}catch(a){return Ul({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},m$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),h$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?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):dp({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 zI,on as g$e}from"node:events";var VK,y$e,_$e,b$e,v$e,WK=y(()=>{jl();sp();op();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),y$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),y$e=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([_$e(o,n,s),b$e(o,r,s),v$e(o,r,s)])}catch(a){throw Nl(t),a}finally{s.abort(),Rb(e,i)}},_$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await zI(t,"message",{signal:r});return n}for await(let[n]of g$e(t,"message",{signal:r}))if(e(n))return n},b$e=async(t,e,{signal:r})=>{await zI(t,"disconnect",{signal:r}),o9(e)},v$e=async(t,e,{signal:r})=>{let[n]=await zI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as JK,on as S$e}from"node:events";var YK,UI,w$e,x$e,$$e,KK,qI=y(()=>{jl();sp();op();YK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>UI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),UI=({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 w$e(t,s,a),x$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})},w$e=async(t,e,r)=>{try{await JK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},x$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JK(t,"strict:error",{signal:r.signal});n.error=kb(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 S$e(r,"message",{signal:o.signal}))KK(s),yield c}catch{KK(s)}finally{o.abort(),Rb(e,a),n||Nl(t),i&&await t}},KK=({error:t})=>{if(t)throw t}});import XK from"node:process";var QK,e3,t3,HI=y(()=>{Ub();WK();qI();Db();QK=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XK,e=!0,r=XK.channel!==void 0;return{...t3(t,e,r),getCancelSignal:C9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},t3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as k$e}from"node:child_process";import{PassThrough as E$e,Readable as A$e,Writable as T$e,Duplex as O$e}from"node:stream";var r3,R$e,hp,I$e,P$e,C$e,D$e,n3=y(()=>{av();fp();rv();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{AI(n);let a=new k$e;R$e(a,n),Object.assign(a,{readable:I$e,writable:P$e,duplex:C$e});let c=Ul({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=D$e(c,s,i);return{subprocess:a,promise:l}},R$e=(t,e)=>{let r=hp(),n=hp(),i=hp(),o=Array.from({length:e.length-3},hp),s=hp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},hp=()=>{let t=new E$e;return t.end(),t},I$e=()=>new A$e({read(){}}),P$e=()=>new T$e({write(){}}),C$e=()=>new O$e({read(){},write(){}}),D$e=async(t,e,r)=>ql(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as N$e}from"node:buffer";import{Readable as gp,Writable as j$e,Duplex as M$e}from"node:stream";var a3,yp,s3,F$e,c3=y(()=>{pv();av();$r();a3=(t,e)=>sv(F$e,t,e,!1),yp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},s3={fileNumber:yp,generator:NI,asyncGenerator:NI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:M$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},F$e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:gp.fromWeb(t)}),iterable:({value:t})=>({stream:gp.from(t)}),asyncIterable:({value:t})=>({stream:gp.from(t)}),string:({value:t})=>({stream:gp.from(t)}),uint8Array:({value:t})=>({stream:gp.from(N$e.from(t))})},output:{...s3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t,append:e}})=>({stream:o3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:j$e.fromWeb(t)}),iterable:yp,asyncIterable:yp,string:yp,uint8Array:yp}}});import{on as L$e,once as l3}from"node:events";import{PassThrough as z$e,getDefaultHighWaterMark as U$e}from"node:stream";import{finished as f3}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)GI(i);let e=t.some(({readableObjectMode:i})=>i),r=q$e(t,e),n=new BI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var q$e,BI,H$e,B$e,G$e,GI,Z$e,V$e,W$e,K$e,J$e,p3,m3,ZI,h3,Y$e,gv,u3,d3,yv=y(()=>{q$e=(t,e)=>{if(t.length===0)return U$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},BI=class extends z$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(GI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=H$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(GI(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)}},H$e=async(t,e,r)=>{gv(t,u3);let n=new AbortController;try{await Promise.race([B$e(t,n),G$e(t,e,r,n)])}finally{n.abort(),gv(t,-u3)}},B$e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},G$e=async(t,e,r,{signal:n})=>{for await(let[i]of L$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},GI=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})=>{gv(t,d3);let a=new AbortController;try{await Promise.race([V$e(o,e,a),W$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),K$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZI(t):J$e(t))},V$e=async(t,e,{signal:r})=>{try{await t,r.aborted||ZI(e)}catch(n){r.aborted||p3(e,n)}},W$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await f3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;m3(s)?i.add(e):h3(t,s)}},K$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await l3(t,i,{signal:o}),!t.readable)return l3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},J$e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?ZI(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZI=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",Y$e),t.destroy(e))},Y$e=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},u3=2,d3=1});import{finished as g3}from"node:stream/promises";var Bl,X$e,VI,Q$e,WI,_v=y(()=>{So();Bl=(t,e)=>{t.pipe(e),X$e(t,e),Q$e(t,e)},X$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}VI(e)}},VI=t=>{t.writable&&t.end()},Q$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}WI(t)}},WI=t=>{t.readable&&t.destroy()}});var y3,eke,tke,rke,nke,ike,_3=y(()=>{yv();So();Tb();$r();_v();y3=(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})=>Cn.has(c)))eke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))rke({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);Bl(s,i)}},eke=(t,e,r,n)=>{r==="output"?Bl(t.stdio[n],e):Bl(e,t.stdio[n]);let i=tke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},tke=["stdin","stdout","stderr"],rke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;nke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},nke=(t,{signal:e})=>{ri(t)&&Na(t,ike,e)},ike=2});var Ha,b3=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 bv,KI,JI,oke,YI,vv,ske,XI,QI,eP,v3,Kct,Jct,S3=y(()=>{b3();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",KI=Symbol.for("signal-exit emitter"),JI=globalThis,oke=Object.defineProperty.bind(Object),YI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(JI[KI])return JI[KI];oke(JI,KI,{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{},ske=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),XI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},QI=class extends vv{#t=eP.platform==="win32"?"SIGINT":"SIGHUP";#r=new YI;#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(!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 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 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)}},eP=globalThis.process,{onExit:v3,load:Kct,unload:Jct}=ske(bv(eP)?new QI(eP):new XI)});import{addAbortListener as ake}from"node:events";var w3,x3=y(()=>{S3();w3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=v3(()=>{t.kill()});ake(n,()=>{i()})}});var k3,cke,lke,$3,uke,E3=y(()=>{$R();hb();hs();Tl();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=cke(r,n,i),{sourceStream:d,sourceError:f}=uke(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}},cke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=lke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},lke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||wR(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($3)(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}`)},$3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),uke=(t,e)=>{try{return{sourceStream:Fl(t,e)}}catch(r){return{sourceError:r}}}});var T3,dke,tP,A3,rP=y(()=>{fp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=dke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw tP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},dke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return WI(t),n;if(e!==void 0)return VI(r),e},tP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ul({error:t,command:A3,escapedCommand:A3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),A3="source.pipe(destination)"});var O3,R3=y(()=>{O3=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 fke}from"node:stream/promises";var I3,pke,mke,hke,Sv,gke,yke,P3=y(()=>{yv();Tb();_v();I3=(t,e,r)=>{let n=Sv.has(e)?mke(t,e):pke(t,e);return Na(t,gke,r.signal),Na(e,yke,r.signal),hke(e),n},pke=(t,e)=>{let r=qa([t]);return Bl(r,e),Sv.set(e,r),r},mke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},hke=async t=>{try{await fke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,gke=2,yke=1});import{aborted as _ke}from"node:util";var C3,bke,D3=y(()=>{rP();C3=(t,e)=>t===void 0?[]:[bke(t,e)],bke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await _ke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw tP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,vke,Ske,N3=y(()=>{bo();E3();rP();R3();P3();D3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=vke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},vke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Ske(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=I3(e,o,d);return await Promise.race([O3(u),...C3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Ske=(t,e)=>Promise.allSettled([t,e])});import{on as wke}from"node:events";import{getDefaultHighWaterMark as xke}from"node:stream";var xv,$ke,nP,kke,M3,iP,j3,Eke,Ake,$v=y(()=>{II();lv();DI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return $ke(e,s),M3({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()}},nP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;kke(e,s,t);let a=t.readableObjectMode&&!o;return M3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},kke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},M3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=wke(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return Eke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},iP=xke(!0),j3=iP,Eke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Ake({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*mp(a)}},Ake=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as Tke}from"node:timers/promises";var F3,Oke,Rke,Ike,oP,L3,sP=y(()=>{Qb();an();jI();$v();La();pp();F3=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=Oke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Rke(t),d]);return}let f=TI(c,r),p=nP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Ike({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Oke=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=nP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CK(a,t,r,o)},Rke=async t=>{await Tke(),t.readableFlowing===null&&t.resume()},Ike=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 L3(yW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},oP=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lZ(t)?new Uint8Array(t):t});import{finished as Pke}from"node:stream/promises";var _p,Cke,Dke,Nke,jke,Mke,aP,kv,z3,Ev=y(()=>{_p=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Cke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Pke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||jke(a,e,r,n)}finally{s.abort()}},Cke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Dke(t,r,n),n},Dke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Nke(e,r),n.call(t,...i)}},Nke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},jke=(t,e,r,n)=>{if(!Mke(t,e,r,n))throw t},Mke=(t,e,r,n=!0)=>r.propagating?z3(t)||kv(t):(r.propagating=!0,aP(r,e)===n?z3(t):kv(t)),aP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,cP,lP=y(()=>{sP();Ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>cP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),cP=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=_p(t,e,l);if(aP(l,e)){await u;return}let[d]=await Promise.all([F3({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 q3,H3,Fke,Lke,uP=y(()=>{yv();lP();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>cP({...Fke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Lke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Fke=({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}},Lke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var B3,G3,Z3=y(()=>{Il();ps();B3=t=>Rl(t,"ipc"),G3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{La();Z3();xo();qI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=B3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of UI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_W(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as zke}from"node:events";var J3,Uke,qke,Hke,Y3=y(()=>{Fa();nI();WR();rI();So();$r();sP();K3();oI();uP();lP();LI();Ev();J3=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 _=zK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=U3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Uke(h,t,S),D=qke(m,S);try{return await Promise.race([Promise.all([{},qK(_),Promise.all(x),w,A,H9(t,d),...T,...D]),g,Hke(t,b),...F9(t,o,f,b),...i9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...j9({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=>oP(ae))),oP(w),W3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_p(n,i,r)),qke=(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})=>_p(s,n,e,{isSameDirection:Cn.has(i),stopOnExit:i==="native"}))),Hke=async(t,{signal:e})=>{let[r]=await zke(t,"error",{signal:e});throw r}});var X3,bp,Gl,Av=y(()=>{Ml();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),bp=(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 Q3}from"node:stream/promises";var dP,eJ,fP,pP,Tv,Ov,mP=y(()=>{Ev();dP=async t=>{if(t!==void 0)try{await fP(t)}catch{}},eJ=async t=>{if(t!==void 0)try{await pP(t)}catch{}},fP=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},pP=async t=>{await Q3(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 Bke}from"node:stream";import{callbackify as Gke}from"node:util";var tJ,hP,gP,yP,Zke,_P,bP,rJ,vP=y(()=>{ja();hs();$v();Ml();Av();mP();tJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=hP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=gP(a,s),{read:f,onStdoutDataDone:p}=yP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Bke({read:f,destroy:Gke(bP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _P({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},hP=(t,e,r)=>{let n=Fl(t,e),i=bp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},gP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:iP},yP=({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{}},_P=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await pP(t),await n,await dP(i),await e,r.readable&&r.push(null)}catch(o){await dP(i),rJ(r,o)}},bP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Gl(r,e)&&(rJ(t,n),await Tv(e,n))},rJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as Vke}from"node:stream";import{callbackify as nJ}from"node:util";var iJ,SP,wP,Wke,Kke,xP,$P,oJ,kP=y(()=>{hs();Av();mP();iJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=SP(t,r,e),s=new Vke({...wP(n,t,i),destroy:nJ($P.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xP(n,s),s},SP=(t,e,r)=>{let n=Ab(t,e),i=bp(r,n,"writableFinal"),o=bp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},wP=(t,e,r)=>({write:Wke.bind(void 0,t),final:nJ(Kke.bind(void 0,t,e,r))}),Wke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Kke=async(t,e,r)=>{await Gl(r,e)&&(t.writable&&t.end(),await e)},xP=async(t,e,r)=>{try{await fP(t),e.writable&&e.end()}catch(n){await eJ(r),oJ(e,n)}},$P=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Gl(r,e),await Gl(n,e)&&(oJ(t,i),await Tv(e,i))},oJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as Jke}from"node:stream";import{callbackify as Yke}from"node:util";var sJ,Xke,aJ=y(()=>{ja();vP();kP();sJ=({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}=hP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=SP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=gP(c,a),{read:g,onStdoutDataDone:b}=yP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Jke({read:g,...wP(u,t,d),destroy:Yke(Xke.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 _P({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),xP(u,_,c),_},Xke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([bP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),$P({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var EP,Qke,cJ=y(()=>{ja();hs();$v();EP=(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 Qke(a,s,t)},Qke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lJ,uJ=y(()=>{Av();vP();kP();aJ();cJ();lJ=(t,{encoding:e})=>{let r=X3();t.readable=tJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=EP.bind(void 0,t,e),t[Symbol.asyncIterator]=EP.bind(void 0,t,e,{})}});var dJ,eEe,tEe,fJ=y(()=>{dJ=(t,e)=>{for(let[r,n]of tEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},eEe=(async()=>{})().constructor.prototype,tEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(eEe,t)])});import{setMaxListeners as rEe}from"node:events";import{spawn as nEe}from"node:child_process";var pJ,iEe,oEe,sEe,aEe,cEe,mJ=y(()=>{Qb();DR();cI();hs();lI();HI();fp();rv();n3();c3();pp();_3();xb();x3();N3();uP();Y3();uJ();Ml();fJ();pJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=iEe(t,e,r),{subprocess:f,promise:p}=sEe({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}),dJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},iEe=(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=oEe(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},oEe=({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}},sEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=nEe(...Bb(t,e,r))}catch(m){return r3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;rEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Di();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lJ(c,r),QK(c,r);let p=aEe({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}},aEe=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 J3({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=cEe({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)},cEe=({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?dp({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,lEe,uEe,hJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,lEe(n,t[n],i)]));return{...t,...r}},lEe=(t,e,r)=>uEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,uEe=new Set(["env",...OR])});var _s,dEe,fEe,gJ=y(()=>{bo();$R();yZ();ZK();mJ();hJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>dEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},dEe=({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}=fEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GK(a,c,l):pJ(a,c,l,i)},fEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hZ(e)?gZ(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 yJ,_J,bJ,pEe,mEe,vJ=y(()=>{yJ=({file:t,commandArguments:e})=>bJ(t,e),_J=({file:t,commandArguments:e})=>({...bJ(t,e),isSync:!0}),bJ=(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]=pEe(t);return{file:r,commandArguments:n}},pEe=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(mEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},mEe=/ +/g});var SJ,wJ,hEe,xJ,gEe,$J,kJ=y(()=>{SJ=(t,e,r)=>{t.sync=e(hEe,r),t.s=t.sync},wJ=({options:t})=>xJ(t),hEe=({options:t})=>({...xJ(t),isSync:!0}),xJ=t=>({options:{...gEe(t),...t}}),gEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$J={preferLocal:!0}});var Ldt,Ke,zdt,Udt,qdt,Hdt,Bdt,Gdt,Zdt,Vdt,zr=y(()=>{gJ();vJ();iI();kJ();HI();Ldt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),zdt=_s(yJ),Udt=_s(_J),qdt=_s(z9),Hdt=_s(wJ,{},$J,SJ),{sendMessage:Bdt,getOneMessage:Gdt,getEachMessage:Zdt,getCancelSignal:Vdt}=e3()});import{existsSync as Iv,statSync as yEe}from"node:fs";import{dirname as AP,extname as _Ee,isAbsolute as EJ,join as TP,relative as OP,resolve as Pv,sep as bEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function vEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function SEe(t,e){let n=OP(t,e).split(bEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function wEe(t,e){let r=Pv(t,e),n=r;Iv(r)?yEe(r).isFile()&&(n=AP(r)):_Ee(r)!==""&&(n=AP(r));let i=OP(t,n);if(i.startsWith("..")||EJ(i))return null;let o=n;for(;;){if(vEe(o))return o;if(Pv(o)===Pv(t))return null;let s=AP(o);if(s===o)return null;let a=OP(t,s);if(a.startsWith("..")||EJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=wEe(r,o);if(!s){i.push(o);continue}let a=SEe(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 IP,readFileSync as xEe}from"node:fs";import{join as Zl}from"node:path";function Vl(t="."){let e=Zl(t,".cladding","config.yaml");if(!IP(e))return RP;try{let n=(0,AJ.parse)(xEe(e,"utf8"))?.gate;if(!n)return RP;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 RP}}function TJ(t="."){let e=Vl(t).testReport,r=e?[e,...PP]:PP;return[...new Set(r.map(n=>Zl(t,n)))]}function OJ(t="."){let e=Vl(t).testReport;if(e){let r=Zl(t,e);return IP(r)?r:null}return PP.map(r=>Zl(t,r)).find(r=>IP(r))??null}function RJ(t,e){let r=[],n=!1;for(let i of t){let o=kEe.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 AJ,$Ee,RP,PP,kEe,vp=y(()=>{"use strict";AJ=wt(tr(),1);Nv();$Ee=["type","lint","test","coverage"],RP={scope:"feature"},PP=["test-report.junit.xml",Zl("coverage","junit.xml"),Zl(".cladding","test-report.junit.xml")];kEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as DP,readFileSync as IJ,readdirSync as EEe,statSync as AEe}from"node:fs";import{join as jv}from"node:path";function MP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(DP(r))try{if(PJ.test(IJ(r,"utf8")))return!0}catch{}}return!1}function CJ(t){try{return DP(t)&&PJ.test(IJ(t,"utf8"))}catch{return!1}}function DJ(t,e=0){if(e>4||!DP(t))return!1;let r;try{r=EEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=AEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CJ(i))return!0}return!1}function REe(t){if(MP(t))return!0;for(let e of TEe)if(CJ(jv(t,e)))return!0;for(let e of OEe)if(DJ(jv(t,e)))return!0;return!1}function NJ(t="."){let e=Vl(t).coverage;return e||(REe(t)?"kover":"jacoco")}function jJ(t="."){return NP[NJ(t)]}function MJ(t="."){return CP[NJ(t)]}var NP,CP,jP,PJ,TEe,OEe,Mv=y(()=>{"use strict";vp();NP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},CP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},jP=[CP.kover,CP.jacoco],PJ=/kover/i;TEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],OEe=["buildSrc","build-logic"]});import{existsSync as wp,readFileSync as LP,readdirSync as LJ,statSync as IEe}from"node:fs";import{dirname as PEe,join as kr,resolve as CEe}from"node:path";import Wl from"node:process";function zP(t){return wp(kr(t,"gradlew"))?"./gradlew":"gradle"}function DEe(t){let e=zP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function NEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LP(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 MEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function zEe(t,e){for(let r of e)if(wp(kr(t,r)))return r}function UEe(t,e){try{return LJ(t).find(n=>n.endsWith(e))}catch{return}}function GEe(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=CEe(t);;){e.push(kr(o,".madgerc"));let s=PEe(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 zJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function WEe(t){try{return IEe(t).isFile()}catch{return!1}}function KEe(t){let e;try{e=LP(t,"utf8")}catch{return!0}try{return zJ(JSON.parse(e).excludeRegExp)}catch{return VEe.test(e)}}function JEe(t,e){let r=e.madge;return r&&typeof r=="object"&&zJ(r.excludeRegExp)||ZEe()?!0:GEe(t).some(n=>WEe(n)&&KEe(n))}function YEe(t){try{return JSON.parse(LP(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 FJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function XEe(t,e,r){if(JEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",BEe),{...e,args:n}}function QEe(t,e,r){if(Sp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of qEe)if(n.configs.some(i=>wp(kr(t,i))))return n.gate;if(HEe.some(n=>wp(kr(t,n)))||r.eslintConfig!==void 0)return e}function tAe(t,e){return eAe.some(r=>wp(kr(t,r)))?!0:e.jest!==void 0}function rAe(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 FP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function nAe(t,e){let r=YEe(t),n=e.lint?QEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:XEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:FP(i,"lint"),s=Sp(r,"test"),a=s?rAe(s):void 0;return s&&!a?(o=FP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...Sp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&tAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!Sp(r,"coverage")&&!FJ(r,"@vitest/coverage-v8")&&!FJ(r,"@vitest/coverage-istanbul")?o=FP(o,"coverage"):a==="vitest"&&Sp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of FEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=UEe(t,o):r=zEe(t,[o]),r)break;if(!r||e.requiresSource&&!MEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?nAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return LEe}var Fi,jEe,FEe,LEe,qEe,HEe,BEe,VEe,eAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];jEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);FEe=[{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:DEe},{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:NEe}],LEe={language:"unknown",manifest:"",gates:{}};qEe=[{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"]}}],HEe=["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"],BEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";VEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;eAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as iAe,readFileSync as oAe}from"node:fs";import{join as sAe}from"node:path";function Ba(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 UJ.test(o)||UJ.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??"")} ${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=nAe(t,"package.json");if(!tAe(r))return!1;try{return!!JSON.parse(rAe(r,"utf8")).scripts?.[e]}catch{return!1}}var UJ,Nn=y(()=>{"use strict";UJ=/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 iAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:iAe}});function oAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:oAe}});import{existsSync as zP,readdirSync as qJ}from"node:fs";import{join as Hv}from"node:path";function aAe(t,e){let r=Hv(t,e.path);if(!zP(r))return!0;if(e.isDirectory)try{return qJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function cAe(t){let{cwd:e="."}=t,r=[];for(let i of sAe)aAe(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(zP(n)){let i=dAe(n),o=i?null:lAe(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=uAe(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 lAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!zP(r))continue;let n;try{n=qJ(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 uAe(t){try{return q(t),null}catch(e){return e.message}}function dAe(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,sAe,HJ,BJ=y(()=>{"use strict";Ue();V_();xp="ABSENCE_OF_GOVERNANCE",sAe=[{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}];HJ={name:xp,run:cAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function UP(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=pAe.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=fAe[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 mAe(t,e){let r=UP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...mAe(r,n));return e}var fAe,pAe,qP=y(()=>{"use strict";fAe={event:"when",state:"while",optional:"where",unwanted:"if"},pAe=/\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 hAe(t){let{cwd:e="."}=t;return ye(e,Gv,gAe)}function gAe(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 GJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,ZJ,VJ=y(()=>{"use strict";qP();xt();Gv="AC_DRIFT";ZJ={name:Gv,run:hAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return KJ[n]??WJ}var yAe,_Ae,bAe,WJ,vAe,SAe,KJ,wAe,JJ,Va=y(()=>{"use strict";Dn();yAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,_Ae=/^[ \t]*import\s+([\w.]+)/gm,bAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:yAe,importStyle:"relative"},vAe={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:_Ae,importStyle:"dotted"},SAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:bAe,importStyle:"dotted"},KJ={typescript:WJ,kotlin:vAe,python:SAe},wAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JJ=new Set([...Object.values(KJ).flatMap(t=>t?.extensions??[]),...wAe].map(t=>t.toLowerCase()))});import{existsSync as xAe,readFileSync as $Ae,readdirSync as kAe,statSync as EAe}from"node:fs";import{join as XJ,relative as YJ}from"node:path";function AAe(t,e){if(!xAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=kAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XJ(i,s),c;try{c=EAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function TAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function RAe(t){return OAe.test(t)}function IAe(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=>AAe(XJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=$Ae(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Va();QJ="AI_HINTS_FORBIDDEN_PATTERN";OAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;e8={name:QJ,run:IAe}});function PAe(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:r8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var r8,n8,i8=y(()=>{"use strict";Ue();r8="AC_DUPLICATE_WITHIN_FEATURE";n8={name:r8,run:PAe}});import{createRequire as CAe}from"module";import{basename as DAe,dirname as BP,normalize as NAe,relative as jAe,resolve as MAe,sep as a8}from"path";import*as FAe from"fs";function LAe(t){let e=NAe(t);return e.length>1&&e[e.length-1]===a8&&(e=e.substring(0,e.length-1)),e}function c8(t,e){return t.replace(zAe,e)}function qAe(t){return t==="/"||UAe.test(t)}function HP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=MAe(t)),(n||o)&&(t=LAe(t)),t===".")return"";let s=t[t.length-1]!==i;return c8(s?t+i:t,i)}function l8(t,e){return e+t}function HAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:c8(jAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function BAe(t){return t}function GAe(t,e,r){return e+t+r}function ZAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?HAe(t,e):n?l8:BAe}function VAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function WAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function XAe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?WAe(t):VAe(t):n&&n.length?JAe:KAe:YAe}function iTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?nTe:r&&r.length?n?QAe:eTe:n?tTe:rTe}function aTe(t){return t.group?sTe:oTe}function uTe(t){return t.group?cTe:lTe}function pTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?fTe:dTe}function u8(t,e,r){if(r.options.useRealPaths)return mTe(e,r);let n=BP(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=BP(n)}return r.symlinks.set(t,e),i>1}function mTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function xTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?hTe:bTe:n?e?gTe:wTe:i?e?_Te:STe:e?yTe:vTe}function ETe(t){return t?kTe:$Te}function RTe(t,e){return new Promise((r,n)=>{p8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function p8(t,e,r){new f8(t,e,r).start()}function ITe(t,e){return new f8(t,e).start()}var o8,zAe,UAe,KAe,JAe,YAe,QAe,eTe,tTe,rTe,nTe,oTe,sTe,cTe,lTe,dTe,fTe,hTe,gTe,yTe,_Te,bTe,vTe,STe,wTe,d8,$Te,kTe,ATe,TTe,OTe,f8,s8,m8,h8,g8=y(()=>{o8=CAe(import.meta.url);zAe=/[\\/]/g;UAe=/^[a-z]:[\\/]$/i;KAe=(t,e)=>{e.push(t||".")},JAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},YAe=()=>{};QAe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},eTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},tTe=(t,e,r,n)=>{r.files++},rTe=(t,e)=>{e.push(t)},nTe=()=>{};oTe=t=>t,sTe=()=>[""].slice(0,0);cTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},lTe=()=>{};dTe=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()&&u8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},fTe=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()&&u8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};hTe=t=>t.counts,gTe=t=>t.groups,yTe=t=>t.paths,_Te=t=>t.paths.slice(0,t.options.maxFiles),bTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),vTe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),STe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),wTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);d8={withFileTypes:!0},$Te=(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||".",d8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},kTe=(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||".",d8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};ATe=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))}},TTe=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}},OTe=class{aborted=!1;abort(){this.aborted=!0}},f8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=xTe(e,this.isSynchronous),this.root=HP(t,e),this.state={root:qAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new TTe,options:e,queue:new ATe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new OTe,fs:e.fs||FAe},this.joinPath=ZAe(this.root,e),this.pushDirectory=XAe(this.root,e),this.pushFile=iTe(e),this.getArray=aTe(e),this.groupFiles=uTe(e),this.resolveSymlink=pTe(e,this.isSynchronous),this.walkDirectory=ETe(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(_=HP(_,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=DAe(_),x=HP(BP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};s8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return RTe(this.root,this.options)}withCallback(t){p8(this.root,this.options,t)}sync(){return ITe(this.root,this.options)}},m8=null;try{o8.resolve("picomatch"),m8=o8("picomatch")}catch{}h8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:a8,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 s8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new s8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||m8;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((Zft,S8)=>{"use strict";var y8="[^\\\\/]",PTe="(?=.)",_8="[^/]",GP="(?:\\/|$)",b8="(?:^|\\/)",ZP=`\\.{1,2}${GP}`,CTe="(?!\\.)",DTe=`(?!${b8}${ZP})`,NTe=`(?!\\.{0,1}${GP})`,jTe=`(?!${ZP})`,MTe="[^.\\/]",FTe=`${_8}*?`,LTe="/",v8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:PTe,QMARK:_8,END_ANCHOR:GP,DOTS_SLASH:ZP,NO_DOT:CTe,NO_DOTS:DTe,NO_DOT_SLASH:NTe,NO_DOTS_SLASH:jTe,QMARK_NO_DOT:MTe,STAR:FTe,START_ANCHOR:b8,SEP:LTe},zTe={...v8,SLASH_LITERAL:"[\\\\/]",QMARK:y8,STAR:`${y8}*?`,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:"\\"},UTe={__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"};S8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:UTe,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?zTe:v8}}});var kp=v(Ur=>{"use strict";var{REGEX_BACKSLASH:qTe,REGEX_REMOVE_BACKSLASH:HTe,REGEX_SPECIAL_CHARS:BTe,REGEX_SPECIAL_CHARS_GLOBAL:GTe}=$p();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>BTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(GTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(qTe,"/");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(HTe,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 O8=v((Wft,T8)=>{"use strict";var w8=kp(),{CHAR_ASTERISK:VP,CHAR_AT:ZTe,CHAR_BACKWARD_SLASH:Ep,CHAR_COMMA:VTe,CHAR_DOT:WP,CHAR_EXCLAMATION_MARK:KP,CHAR_FORWARD_SLASH:A8,CHAR_LEFT_CURLY_BRACE:JP,CHAR_LEFT_PARENTHESES:YP,CHAR_LEFT_SQUARE_BRACKET:WTe,CHAR_PLUS:KTe,CHAR_QUESTION_MARK:x8,CHAR_RIGHT_CURLY_BRACE:JTe,CHAR_RIGHT_PARENTHESES:$8,CHAR_RIGHT_SQUARE_BRACKET:YTe}=$p(),k8=t=>t===A8||t===Ep,E8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},XTe=(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&&k8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=w8.removeBackslashes(C)),J&&_===!0&&(J=w8.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,k8(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(),ln=kp(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:QTe,REGEX_NON_SPECIAL_CHARS:eOe,REGEX_SPECIAL_CHARS_BACKREF:tOe,REPLACEMENTS:R8}=Ap,rOe=(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=>ln.escapeRegex(i)).join("..")}return r},Kl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,I8=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},nOe=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},QP=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(nOe(e))return e.replace(/\\(.)/g,"$1")},iOe=t=>{let e=t.map(QP).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}}}}},oOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,sOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=QP(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},aOe=t=>{let e=0,r=t.trim(),n=XP(r);for(;n;)e++,r=n.body.trim(),n=XP(r);return e},cOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=I8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||iOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=sOe(a);if(c){o=!0,i.push(...c);continue}let l=QP(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,aOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:oOe([...new Set(i)])}:{risky:!0}:{risky:!1}},eC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R8[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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},$fe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=cOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=eC(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,ht=t.replace(tOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=QTe[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=ln.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){$fe(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||ln.hasRegexChars(B))continue;let Oe=ln.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=rOe(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=eOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Kl("closing","}"));E.output=ln.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};eC.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=R8[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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};P8.exports=eC});var j8=v((Jft,N8)=>{"use strict";var lOe=O8(),tC=C8(),D8=kp(),uOe=$p(),dOe=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=dOe(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?D8.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(D8.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)):tC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>lOe(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=tC.fastpaths(t,e)),i.output||(i=tC(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=uOe;N8.exports=Rt});var z8=v((Yft,L8)=>{"use strict";var M8=j8(),fOe=kp();function F8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:fOe.isWindows()}),M8(t,e,r)}Object.assign(F8,M8);L8.exports=F8});import{readdir as pOe,readdirSync as mOe,realpath as hOe,realpathSync as gOe,stat as yOe,statSync as _Oe}from"fs";import{isAbsolute as bOe,posix as Wa,resolve as vOe}from"path";import{fileURLToPath as SOe}from"url";function kOe(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]===".."&&$Oe.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 TOe(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 q8(t){return t.replace(xOe,e=>`${e}/`)}function Z8(t){var e;let r=Jl.default.scan(t,OOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function NOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Jl.default.scan(t);return r.isGlob||r.negated}function Tp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function V8(t){return typeof t=="string"?[t]:t??[]}function rC(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=DOe(o);s=bOe(s.replace(MOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=jOe.exec(s))===null||i===void 0?void 0:i[0],l=Z8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=q8(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 FOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(rC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(rC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(rC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function LOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=FOe(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(B8,""),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=kOe(i.match,f),g=U8(r,d,o),b=o?g:U8(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 h8({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&&TOe(r,d)]}function zOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function UOe(t){let e=Object.assign({},t);for(let r in H8)e[r]===void 0&&Object.assign(e,{[r]:H8[r]});return e.cwd=(e.cwd instanceof URL?SOe(e.cwd):vOe(e.cwd||process.cwd())).replace(B8,"/"),e.ignore=V8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||pOe,readdirSync:e.fs.readdirSync||mOe,realpath:e.fs.realpath||hOe,realpathSync:e.fs.realpathSync||gOe,stat:e.fs.stat||yOe,statSync:e.fs.statSync||_Oe}),e.debug&&Tp("globbing with options:",e),e}function qOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=wOe(t)||typeof t=="string",i=V8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=UOe(n?e:t);return i.length>0?LOe(o,i):[]}function vs(t,e){let[r,n]=qOe(t,e);return r?zOe(r.sync(),n):[]}var Jl,wOe,B8,xOe,G8,$Oe,EOe,AOe,OOe,ROe,IOe,POe,COe,DOe,jOe,MOe,H8,Op=y(()=>{g8();Jl=wt(z8(),1),wOe=Array.isArray,B8=/\\/g,xOe=/^[A-Za-z]:$/,G8=process.platform==="win32",$Oe=/^(\/?\.\.)+$/;EOe=/^[A-Z]:\/$/i,AOe=G8?t=>EOe.test(t):t=>t==="/";OOe={parts:!0};ROe=/(?t.replace(ROe,"\\$&"),COe=t=>t.replace(IOe,"\\$&"),DOe=G8?COe:POe;jOe=/^(\/?\.\.)+/,MOe=/\\(?=[()[\]{}!*+?@|])/g;H8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Rp,readFileSync as HOe,readdirSync as BOe,statSync as W8}from"node:fs";import{join as Ka}from"node:path";function GOe(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}=nC(r);return(s.size>0||a.length>0)&&!Rp(Ka(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&&(ZOe(e,i,s,o),VOe(e,i,s,o)),a.length>0&&WOe(e,i,a,o),o)}function nC(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 ZOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of BOe(o)){let a=Ka(o,s);W8(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 VOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of r){let a=Ka(o,s);Rp(a)&&W8(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 WOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Rp(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=HOe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];KOe(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 KOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ip,K8,iC=y(()=>{"use strict";Op();Ue();Va();Ip="ARCHITECTURE_FROM_SPEC";K8={name:Ip,run:GOe}});import{existsSync as JOe,readFileSync as YOe}from"node:fs";import{join as XOe}from"node:path";function eRe(t){let{cwd:e="."}=t,r=XOe(e,"spec/capabilities.yaml");if(!JOe(r))return[];let n;try{let u=YOe(r,"utf8"),d=J8.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";J8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",QOe=8;Y8={name:Wv,run:eRe}});import{existsSync as tRe,readFileSync as rRe}from"node:fs";import{join as nRe}from"node:path";function iRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function oRe(t){let{cwd:e="."}=t;return ye(e,oC,r=>sRe(r,e))}function sRe(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=nRe(e,o);if(!tRe(s))continue;let a=rRe(s,"utf8");iRe(a)||n.push({detector:oC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var oC,Q8,e5=y(()=>{"use strict";Va();xt();oC="CONVENTION_DRIFT";Q8={name:oC,run:oRe}});import{existsSync as sC,readFileSync as t5}from"node:fs";import{join as Kv}from"node:path";function aRe(t){return JSON.parse(t).total?.lines?.pct??0}function r5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function uRe(t,e){if(!Cv(_t(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=NP.find(d=>sC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=r5(t5(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=n5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function dRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=uRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?NP.find(a=>sC(Kv(e,a)))??MJ(e):n.coverageSummary,o=Kv(e,i);if(!sC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=t5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?cRe(a):n.coverageFormat==="cobertura-xml"?lRe(a):aRe(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,i5,o5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;i5={name:Eo,run:dRe}});import{existsSync as fRe}from"node:fs";import{join as pRe}from"node:path";function hRe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>gRe(r,e))}function gRe(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",mRe=8;s5={name:Yv,run:hRe}});function yRe(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 _Re(t){let e=yRe(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 bRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>_Re(r))}var Xv,c5,l5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";c5={name:Xv,run:bRe}});function vRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>SRe(r,e))}function SRe(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,aC=y(()=>{"use strict";$l();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:vRe}});function wRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return xRe(r)}function xRe(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:u5,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 u5,tS,cC=y(()=>{"use strict";Ue();u5="DEPENDENCY_CYCLE";tS={name:u5,run:wRe}});import{appendFileSync as $Re,existsSync as d5,mkdirSync as kRe,readFileSync as ERe}from"node:fs";import{dirname as ARe,join as TRe}from"node:path";function f5(t){return TRe(t,ORe,RRe)}function p5(t){return lC.add(t),()=>lC.delete(t)}function Ja(t,e){let r=f5(t),n=ARe(r);d5(n)||kRe(n,{recursive:!0}),$Re(r,`${JSON.stringify(e)} -`,"utf8");for(let i of lC)try{i(t,e)}catch{}}function pr(t){let e=f5(t);if(!d5(e))return[];let r=ERe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var ORe,RRe,lC,un=y(()=>{"use strict";ORe=".cladding",RRe="audit.log.jsonl";lC=new Set});import{existsSync as IRe}from"node:fs";import{join as PRe}from"node:path";function CRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:uC,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&&(IRe(PRe(e,i.artifact))||n.push({detector:uC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var uC,m5,h5=y(()=>{"use strict";un();uC="EVIDENCE_MISMATCH";m5={name:uC,run:CRe}});import{existsSync as DRe,readFileSync as NRe}from"node:fs";import{join as jRe}from"node:path";function MRe(t){let e=jRe(t,b5);if(!DRe(e))return null;try{let n=((0,_5.parse)(NRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*y5(t,e){for(let r of t??[])r.startsWith(g5)&&(yield{ref:r,name:r.slice(g5.length),field:e})}function FRe(t){let{cwd:e="."}=t,r=MRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:dC,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=[...y5(s.evidence_refs,"evidence_refs"),...y5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:dC,severity:"warn",path:b5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var _5,dC,g5,b5,v5,S5=y(()=>{"use strict";_5=wt(tr(),1);Ue();dC="FIXTURE_REFERENCE_INVALID",g5="fixture:",b5="conformance/fixtures.yaml";v5={name:dC,run:FRe}});import{existsSync as Yl,readFileSync as fC}from"node:fs";import{join as Ya}from"node:path";function LRe(t){return vs(["src/stages/detectors/*.ts"],{cwd:t,dot:!1}).filter(r=>!/[/\\](index|with-spec|spec-first-window)\.ts$/.test(r)).length}function Pp(t){if(!Yl(t))return null;try{return JSON.parse(fC(t,"utf8"))}catch{return null}}function zRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(fC(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=LRe(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 URe(t,e){for(let r of w5){let n=Ya(t,r.path);if(!Yl(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 qRe(t,e){let r=Pp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of w5){let s=Ya(t,o.path);if(!Yl(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=Ya(t,".claude-plugin","marketplace.json");if(Yl(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 HRe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function BRe(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=HRe(fC(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 GRe(t){let{cwd:e="."}=t,r=[];return zRe(e,r),BRe(e,r),URe(e,r),qRe(e,r),r}var Ao,w5,x5,$5=y(()=>{"use strict";Op();Ao="HARNESS_INTEGRITY",w5=[{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"]}];x5={name:Ao,run:GRe}});import{existsSync as ZRe,readFileSync as VRe}from"node:fs";import{join as WRe}from"node:path";function JRe(t){let{cwd:e="."}=t;return ye(e,rS,r=>XRe(r,e))}function YRe(t){let e=WRe(t,"spec/capabilities.yaml");if(!ZRe(e))return!1;try{let r=k5.default.parse(VRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function XRe(t,e){let r=t.features.length;if(r{"use strict";k5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",KRe=8;E5={name:rS,run:JRe}});function QRe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function eIe(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+=` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Kl(t,e){let r=sAe(t,"package.json");if(!iAe(r))return!1;try{return!!JSON.parse(oAe(r,"utf8")).scripts?.[e]}catch{return!1}}var UJ,Nn=y(()=>{"use strict";UJ=/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 aAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:aAe}});function cAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:cAe}});import{existsSync as UP,readdirSync as qJ}from"node:fs";import{join as Hv}from"node:path";function uAe(t,e){let r=Hv(t,e.path);if(!UP(r))return!0;if(e.isDirectory)try{return qJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function dAe(t){let{cwd:e="."}=t,r=[];for(let i of lAe)uAe(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(UP(n)){let i=mAe(n),o=i?null:fAe(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=pAe(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 fAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!UP(r))continue;let n;try{n=qJ(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 pAe(t){try{return q(t),null}catch(e){return e.message}}function mAe(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,lAe,HJ,BJ=y(()=>{"use strict";Ue();V_();xp="ABSENCE_OF_GOVERNANCE",lAe=[{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}];HJ={name:xp,run:dAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function qP(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=gAe.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=hAe[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 yAe(t,e){let r=qP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...yAe(r,n));return e}var hAe,gAe,HP=y(()=>{"use strict";hAe={event:"when",state:"while",optional:"where",unwanted:"if"},gAe=/\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 _Ae(t){let{cwd:e="."}=t;return ye(e,Gv,bAe)}function bAe(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 GJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,ZJ,VJ=y(()=>{"use strict";HP();xt();Gv="AC_DRIFT";ZJ={name:Gv,run:_Ae}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return KJ[n]??WJ}var vAe,SAe,wAe,WJ,xAe,$Ae,KJ,kAe,JJ,Va=y(()=>{"use strict";Dn();vAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,SAe=/^[ \t]*import\s+([\w.]+)/gm,wAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:vAe,importStyle:"relative"},xAe={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:SAe,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:wAe,importStyle:"dotted"},KJ={typescript:WJ,kotlin:xAe,python:$Ae},kAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JJ=new Set([...Object.values(KJ).flatMap(t=>t?.extensions??[]),...kAe].map(t=>t.toLowerCase()))});import{existsSync as EAe,readFileSync as AAe,readdirSync as TAe,statSync as OAe}from"node:fs";import{join as XJ,relative as YJ}from"node:path";function RAe(t,e){if(!EAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=TAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XJ(i,s),c;try{c=OAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function IAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function CAe(t){return PAe.test(t)}function DAe(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=>RAe(XJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=AAe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Va();QJ="AI_HINTS_FORBIDDEN_PATTERN";PAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;e8={name:QJ,run:DAe}});function NAe(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:r8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var r8,n8,i8=y(()=>{"use strict";Ue();r8="AC_DUPLICATE_WITHIN_FEATURE";n8={name:r8,run:NAe}});import{createRequire as jAe}from"module";import{basename as MAe,dirname as GP,normalize as FAe,relative as LAe,resolve as zAe,sep as a8}from"path";import*as UAe from"fs";function qAe(t){let e=FAe(t);return e.length>1&&e[e.length-1]===a8&&(e=e.substring(0,e.length-1)),e}function c8(t,e){return t.replace(HAe,e)}function GAe(t){return t==="/"||BAe.test(t)}function BP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=zAe(t)),(n||o)&&(t=qAe(t)),t===".")return"";let s=t[t.length-1]!==i;return c8(s?t+i:t,i)}function l8(t,e){return e+t}function ZAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:c8(LAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function VAe(t){return t}function WAe(t,e,r){return e+t+r}function KAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?ZAe(t,e):n?l8:VAe}function JAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function YAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function tTe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?YAe(t):JAe(t):n&&n.length?QAe:XAe:eTe}function aTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?sTe:r&&r.length?n?rTe:nTe:n?iTe:oTe}function uTe(t){return t.group?lTe:cTe}function pTe(t){return t.group?dTe:fTe}function gTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?hTe:mTe}function u8(t,e,r){if(r.options.useRealPaths)return yTe(e,r);let n=GP(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=GP(n)}return r.symlinks.set(t,e),i>1}function yTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function ETe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?_Te:wTe:n?e?bTe:kTe:i?e?STe:$Te:e?vTe:xTe}function OTe(t){return t?TTe:ATe}function CTe(t,e){return new Promise((r,n)=>{p8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function p8(t,e,r){new f8(t,e,r).start()}function DTe(t,e){return new f8(t,e).start()}var o8,HAe,BAe,XAe,QAe,eTe,rTe,nTe,iTe,oTe,sTe,cTe,lTe,dTe,fTe,mTe,hTe,_Te,bTe,vTe,STe,wTe,xTe,$Te,kTe,d8,ATe,TTe,RTe,ITe,PTe,f8,s8,m8,h8,g8=y(()=>{o8=jAe(import.meta.url);HAe=/[\\/]/g;BAe=/^[a-z]:[\\/]$/i;XAe=(t,e)=>{e.push(t||".")},QAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},eTe=()=>{};rTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},nTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},iTe=(t,e,r,n)=>{r.files++},oTe=(t,e)=>{e.push(t)},sTe=()=>{};cTe=t=>t,lTe=()=>[""].slice(0,0);dTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},fTe=()=>{};mTe=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()&&u8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},hTe=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()&&u8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};_Te=t=>t.counts,bTe=t=>t.groups,vTe=t=>t.paths,STe=t=>t.paths.slice(0,t.options.maxFiles),wTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),xTe=(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),kTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);d8={withFileTypes:!0},ATe=(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||".",d8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},TTe=(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||".",d8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};RTe=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))}},ITe=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}},PTe=class{aborted=!1;abort(){this.aborted=!0}},f8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ETe(e,this.isSynchronous),this.root=BP(t,e),this.state={root:GAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ITe,options:e,queue:new RTe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new PTe,fs:e.fs||UAe},this.joinPath=KAe(this.root,e),this.pushDirectory=tTe(this.root,e),this.pushFile=aTe(e),this.getArray=uTe(e),this.groupFiles=pTe(e),this.resolveSymlink=gTe(e,this.isSynchronous),this.walkDirectory=OTe(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(_=BP(_,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=MAe(_),x=BP(GP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};s8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return CTe(this.root,this.options)}withCallback(t){p8(this.root,this.options,t)}sync(){return DTe(this.root,this.options)}},m8=null;try{o8.resolve("picomatch"),m8=o8("picomatch")}catch{}h8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:a8,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 s8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new s8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||m8;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((Yft,S8)=>{"use strict";var y8="[^\\\\/]",NTe="(?=.)",_8="[^/]",ZP="(?:\\/|$)",b8="(?:^|\\/)",VP=`\\.{1,2}${ZP}`,jTe="(?!\\.)",MTe=`(?!${b8}${VP})`,FTe=`(?!\\.{0,1}${ZP})`,LTe=`(?!${VP})`,zTe="[^.\\/]",UTe=`${_8}*?`,qTe="/",v8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:NTe,QMARK:_8,END_ANCHOR:ZP,DOTS_SLASH:VP,NO_DOT:jTe,NO_DOTS:MTe,NO_DOT_SLASH:FTe,NO_DOTS_SLASH:LTe,QMARK_NO_DOT:zTe,STAR:UTe,START_ANCHOR:b8,SEP:qTe},HTe={...v8,SLASH_LITERAL:"[\\\\/]",QMARK:y8,STAR:`${y8}*?`,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:"\\"},BTe={__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"};S8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:BTe,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?HTe:v8}}});var kp=v(Ur=>{"use strict";var{REGEX_BACKSLASH:GTe,REGEX_REMOVE_BACKSLASH:ZTe,REGEX_SPECIAL_CHARS:VTe,REGEX_SPECIAL_CHARS_GLOBAL:WTe}=$p();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>VTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(WTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(GTe,"/");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 O8=v((Qft,T8)=>{"use strict";var w8=kp(),{CHAR_ASTERISK:WP,CHAR_AT:KTe,CHAR_BACKWARD_SLASH:Ep,CHAR_COMMA:JTe,CHAR_DOT:KP,CHAR_EXCLAMATION_MARK:JP,CHAR_FORWARD_SLASH:A8,CHAR_LEFT_CURLY_BRACE:YP,CHAR_LEFT_PARENTHESES:XP,CHAR_LEFT_SQUARE_BRACKET:YTe,CHAR_PLUS:XTe,CHAR_QUESTION_MARK:x8,CHAR_RIGHT_CURLY_BRACE:QTe,CHAR_RIGHT_PARENTHESES:$8,CHAR_RIGHT_SQUARE_BRACKET:eOe}=$p(),k8=t=>t===A8||t===Ep,E8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},tOe=(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&&k8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=w8.removeBackslashes(C)),J&&_===!0&&(J=w8.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,k8(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(),ln=kp(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:rOe,REGEX_NON_SPECIAL_CHARS:nOe,REGEX_SPECIAL_CHARS_BACKREF:iOe,REPLACEMENTS:R8}=Ap,oOe=(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=>ln.escapeRegex(i)).join("..")}return r},Jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,I8=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},sOe=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},eC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(sOe(e))return e.replace(/\\(.)/g,"$1")},aOe=t=>{let e=t.map(eC).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}}}}},cOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,lOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=eC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},uOe=t=>{let e=0,r=t.trim(),n=QP(r);for(;n;)e++,r=n.body.trim(),n=QP(r);return e},dOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=I8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||aOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=lOe(a);if(c){o=!0,i.push(...c);continue}let l=eC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,uOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:cOe([...new Set(i)])}:{risky:!0}:{risky:!1}},tC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R8[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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Afe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=dOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=tC(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,ht=t.replace(iOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=rOe[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=ln.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){Afe(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||ln.hasRegexChars(B))continue;let Oe=ln.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=oOe(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=nOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","}"));E.output=ln.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};tC.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=R8[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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};P8.exports=tC});var j8=v((tpt,N8)=>{"use strict";var fOe=O8(),rC=C8(),D8=kp(),pOe=$p(),mOe=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=mOe(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?D8.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(D8.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)):rC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>fOe(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=rC.fastpaths(t,e)),i.output||(i=rC(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=pOe;N8.exports=Rt});var z8=v((rpt,L8)=>{"use strict";var M8=j8(),hOe=kp();function F8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:hOe.isWindows()}),M8(t,e,r)}Object.assign(F8,M8);L8.exports=F8});import{readdir as gOe,readdirSync as yOe,realpath as _Oe,realpathSync as bOe,stat as vOe,statSync as SOe}from"fs";import{isAbsolute as wOe,posix as Wa,resolve as xOe}from"path";import{fileURLToPath as $Oe}from"url";function TOe(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]===".."&&AOe.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 IOe(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 q8(t){return t.replace(EOe,e=>`${e}/`)}function Z8(t){var e;let r=Yl.default.scan(t,POe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function FOe(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 V8(t){return typeof t=="string"?[t]:t??[]}function nC(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=MOe(o);s=wOe(s.replace(zOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=LOe.exec(s))===null||i===void 0?void 0:i[0],l=Z8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=q8(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 UOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(nC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(nC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(nC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function qOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=UOe(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(B8,""),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=TOe(i.match,f),g=U8(r,d,o),b=o?g:U8(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 h8({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&&IOe(r,d)]}function HOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function BOe(t){let e=Object.assign({},t);for(let r in H8)e[r]===void 0&&Object.assign(e,{[r]:H8[r]});return e.cwd=(e.cwd instanceof URL?$Oe(e.cwd):xOe(e.cwd||process.cwd())).replace(B8,"/"),e.ignore=V8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||gOe,readdirSync:e.fs.readdirSync||yOe,realpath:e.fs.realpath||_Oe,realpathSync:e.fs.realpathSync||bOe,stat:e.fs.stat||vOe,statSync:e.fs.statSync||SOe}),e.debug&&Tp("globbing with options:",e),e}function GOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=kOe(t)||typeof t=="string",i=V8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=BOe(n?e:t);return i.length>0?qOe(o,i):[]}function vs(t,e){let[r,n]=GOe(t,e);return r?HOe(r.sync(),n):[]}var Yl,kOe,B8,EOe,G8,AOe,OOe,ROe,POe,COe,DOe,NOe,jOe,MOe,LOe,zOe,H8,Op=y(()=>{g8();Yl=wt(z8(),1),kOe=Array.isArray,B8=/\\/g,EOe=/^[A-Za-z]:$/,G8=process.platform==="win32",AOe=/^(\/?\.\.)+$/;OOe=/^[A-Z]:\/$/i,ROe=G8?t=>OOe.test(t):t=>t==="/";POe={parts:!0};COe=/(?t.replace(COe,"\\$&"),jOe=t=>t.replace(DOe,"\\$&"),MOe=G8?jOe:NOe;LOe=/^(\/?\.\.)+/,zOe=/\\(?=[()[\]{}!*+?@|])/g;H8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Rp,readFileSync as ZOe,readdirSync as VOe,statSync as W8}from"node:fs";import{join as Ka}from"node:path";function WOe(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}=iC(r);return(s.size>0||a.length>0)&&!Rp(Ka(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&&(KOe(e,i,s,o),JOe(e,i,s,o)),a.length>0&&YOe(e,i,a,o),o)}function iC(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 KOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of VOe(o)){let a=Ka(o,s);W8(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 JOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of r){let a=Ka(o,s);Rp(a)&&W8(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 YOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Rp(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];XOe(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 XOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ip,K8,oC=y(()=>{"use strict";Op();Ue();Va();Ip="ARCHITECTURE_FROM_SPEC";K8={name:Ip,run:WOe}});import{existsSync as QOe,readFileSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t,r=tRe(e,"spec/capabilities.yaml");if(!QOe(r))return[];let n;try{let u=eRe(r,"utf8"),d=J8.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";J8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",rRe=8;Y8={name:Wv,run:nRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as sRe}from"node:path";function aRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function cRe(t){let{cwd:e="."}=t;return ye(e,sC,r=>lRe(r,e))}function lRe(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=sRe(e,o);if(!iRe(s))continue;let a=oRe(s,"utf8");aRe(a)||n.push({detector:sC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var sC,Q8,e5=y(()=>{"use strict";Va();xt();sC="CONVENTION_DRIFT";Q8={name:sC,run:cRe}});import{existsSync as aC,readFileSync as t5}from"node:fs";import{join as Kv}from"node:path";function uRe(t){return JSON.parse(t).total?.lines?.pct??0}function r5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function pRe(t,e){if(!Cv(_t(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=jP.find(d=>aC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=r5(t5(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=n5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function mRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=pRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?jP.find(a=>aC(Kv(e,a)))??MJ(e):n.coverageSummary,o=Kv(e,i);if(!aC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=t5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?dRe(a):n.coverageFormat==="cobertura-xml"?fRe(a):uRe(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,i5,o5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;i5={name:Eo,run:mRe}});import{existsSync as hRe}from"node:fs";import{join as gRe}from"node:path";function _Re(t){let{cwd:e="."}=t;return ye(e,Yv,r=>bRe(r,e))}function bRe(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",yRe=8;s5={name:Yv,run:_Re}});function vRe(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 SRe(t){let e=vRe(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 wRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>SRe(r))}var Xv,c5,l5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";c5={name:Xv,run:wRe}});function xRe(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,cC=y(()=>{"use strict";kl();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:xRe}});function kRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return ERe(r)}function ERe(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:u5,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 u5,tS,lC=y(()=>{"use strict";Ue();u5="DEPENDENCY_CYCLE";tS={name:u5,run:kRe}});import{appendFileSync as ARe,existsSync as d5,mkdirSync as TRe,readFileSync as ORe}from"node:fs";import{dirname as RRe,join as IRe}from"node:path";function f5(t){return IRe(t,PRe,CRe)}function p5(t){return uC.add(t),()=>uC.delete(t)}function Ja(t,e){let r=f5(t),n=RRe(r);d5(n)||TRe(n,{recursive:!0}),ARe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of uC)try{i(t,e)}catch{}}function pr(t){let e=f5(t);if(!d5(e))return[];let r=ORe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var PRe,CRe,uC,un=y(()=>{"use strict";PRe=".cladding",CRe="audit.log.jsonl";uC=new Set});import{existsSync as DRe}from"node:fs";import{join as NRe}from"node:path";function jRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:dC,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&&(DRe(NRe(e,i.artifact))||n.push({detector:dC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var dC,m5,h5=y(()=>{"use strict";un();dC="EVIDENCE_MISMATCH";m5={name:dC,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function zRe(t){let e=LRe(t,b5);if(!MRe(e))return null;try{let n=((0,_5.parse)(FRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*y5(t,e){for(let r of t??[])r.startsWith(g5)&&(yield{ref:r,name:r.slice(g5.length),field:e})}function URe(t){let{cwd:e="."}=t,r=zRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:fC,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=[...y5(s.evidence_refs,"evidence_refs"),...y5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:fC,severity:"warn",path:b5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var _5,fC,g5,b5,v5,S5=y(()=>{"use strict";_5=wt(tr(),1);Ue();fC="FIXTURE_REFERENCE_INVALID",g5="fixture:",b5="conformance/fixtures.yaml";v5={name:fC,run:URe}});import{existsSync as Xl,readFileSync as pC}from"node:fs";import{join as Ya}from"node:path";function qRe(t){return vs(["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(pC(t,"utf8"))}catch{return null}}function HRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(pC(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=qRe(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 BRe(t,e){for(let r of w5){let n=Ya(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 GRe(t,e){let r=Pp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of w5){let s=Ya(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=Ya(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 VRe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Xl(r)||!Xl(n))return;let i=ZRe(pC(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 WRe(t){let{cwd:e="."}=t,r=[];return HRe(e,r),VRe(e,r),BRe(e,r),GRe(e,r),r}var Ao,w5,x5,$5=y(()=>{"use strict";Op();Ao="HARNESS_INTEGRITY",w5=[{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"]}];x5={name:Ao,run:WRe}});import{existsSync as KRe,readFileSync as JRe}from"node:fs";import{join as YRe}from"node:path";function QRe(t){let{cwd:e="."}=t;return ye(e,rS,r=>tIe(r,e))}function eIe(t){let e=YRe(t,"spec/capabilities.yaml");if(!KRe(e))return!1;try{let r=k5.default.parse(JRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function tIe(t,e){let r=t.features.length;if(r{"use strict";k5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",XRe=8;E5={name:rS,run:QRe}});function rIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function nIe(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]=QRe(r.toml,r.ptr),o=eIe(r.toml,n,i);super(`Invalid TOML document: ${e} +`))}return i}var ge,Xa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=rIe(r.toml,r.ptr),o=nIe(r.toml,n,i);super(`Invalid TOML document: ${e} -${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function tIe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function nS(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!=="'"&&tIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Cp=y(()=>{Xa();});var rIe,Qa,pC=y(()=>{rIe=/^(\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(rIe);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]===` +`))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!=="'"&&iIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Cp=y(()=>{Xa();});var oIe,Qa,mC=y(()=>{oIe=/^(\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(oIe);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{Cp();pC();Xa();nIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,iIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,oIe=/^[+-]?0[0-9_]/,sIe=/^[0-9a-f]{2,8}$/i,O5={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function aIe(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 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==="["?P5(t,e,n,i):I5(t,e,n,i);if(r){if(l=dn(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=dn(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=T5(t,e,",",r);let a=aIe(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=dn(t,e+a[1]),s+=+(t[s]===",")),[R5(a[0],t,e,i),s]}var hC=y(()=>{mC();gC();Cp();Xa();});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(!cIe.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{mC();hC();Cp();Xa();cIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function C5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{gC();hC();Cp();Xa();});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 lIe(t){for(let e=0;e{Cp();mC();Xa();sIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,aIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,cIe=/^[+-]?0[0-9_]/,lIe=/^[0-9a-f]{2,8}$/i,O5={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function uIe(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==="["?P5(t,e,n,i):I5(t,e,n,i);if(r){if(l=dn(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=dn(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=T5(t,e,",",r);let a=uIe(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=dn(t,e+a[1]),s+=+(t[s]===",")),[R5(a[0],t,e,i),s]}var gC=y(()=>{hC();yC();Cp();Xa();});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(!dIe.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{hC();gC();Cp();Xa();dIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function C5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{yC();gC();Cp();Xa();});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 fIe(t){for(let e=0;e{N5=/^[a-z0-9-_]+$/i});var wC={};Nr(wC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>pIe,parse:()=>yC,stringify:()=>SC});var pIe,xC=y(()=>{D5();j5();pC();Xa();pIe={parse:yC,stringify:SC,TomlDate:Qa,TomlError:ge}});import{cpSync as mIe,existsSync as jn,lstatSync as hIe,mkdirSync as gIe,readFileSync as uS,readlinkSync as yIe,readdirSync as _Ie,rmSync as F5,writeFileSync as ec}from"node:fs";import{homedir as L5,platform as z5}from"node:os";import{basename as bIe,dirname as Ss,isAbsolute as vIe,join as he,relative as SIe,resolve as ws}from"node:path";import{fileURLToPath as wIe}from"node:url";import{spawnSync as U5}from"node:child_process";function aS(t){gIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return hIe(t).isSymbolicLink()}catch{return!1}}function kIe(t){try{return ws(Ss(t),yIe(t))}catch{return null}}function q5(t,e){let r=SIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!vIe(r)}function EIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",kC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=kIe(t);if(!r||!e.some(n=>q5(r,n)))return"skipped-different";try{return F5(t,{force:!0}),"removed"}catch{return"failed"}}function AIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of _Ie(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]===EC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>q5(n[0],i))}function TIe(t,e){let r=t.split(` +`:n}var N5,j5=y(()=>{N5=/^[a-z0-9-_]+$/i});var xC={};Nr(xC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>gIe,parse:()=>_C,stringify:()=>wC});var gIe,$C=y(()=>{D5();j5();mC();Xa();gIe={parse:_C,stringify:wC,TomlDate:Qa,TomlError:ge}});import{cpSync as yIe,existsSync as jn,lstatSync as _Ie,mkdirSync as bIe,readFileSync as uS,readlinkSync as vIe,readdirSync as SIe,rmSync as F5,writeFileSync as ec}from"node:fs";import{homedir as L5,platform as z5}from"node:os";import{basename as wIe,dirname as Ss,isAbsolute as xIe,join as he,relative as $Ie,resolve as ws}from"node:path";import{fileURLToPath as kIe}from"node:url";import{spawnSync as U5}from"node:child_process";function aS(t){bIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return _Ie(t).isSymbolicLink()}catch{return!1}}function TIe(t){try{return ws(Ss(t),vIe(t))}catch{return null}}function q5(t,e){let r=$Ie(ws(e),ws(t));return r===""||!r.startsWith("..")&&!xIe(r)}function OIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",EC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=TIe(t);if(!r||!e.some(n=>q5(r,n)))return"skipped-different";try{return F5(t,{force:!0}),"removed"}catch{return"failed"}}function RIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of SIe(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]===AC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>q5(n[0],i))}function IIe(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 OIe(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(()=>(xC(),wC)),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=TIe(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 RIe(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,ec(r,`${JSON.stringify(i,null,2)} -`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function IIe(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 Ql([o,tc(he(n,"plugin.json"),s)])}function PIe(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 CIe(t){let e=z5()==="win32"?"where":"which";return U5(e,[t],{stdio:"ignore"}).status===0}function DIe(t){if(!t||!CIe("claude"))return"manual-required";let e=U5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:z5()==="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 NIe(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 jIe(){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 MIe(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(` +`)}async function PIe(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(()=>($C(),xC)),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=IIe(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 CIe(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,ec(r,`${JSON.stringify(i,null,2)} +`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function DIe(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,tc(he(n,"plugin.json"),s)])}function NIe(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 jIe(t){let e=z5()==="win32"?"where":"which";return U5(e,[t],{stdio:"ignore"}).status===0}function MIe(t){if(!t||!jIe("claude"))return"manual-required";let e=U5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:z5()==="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 FIe(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 LIe(){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 zIe(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(` `)?` `:"";ec(e,`${n}${s}${o.join(` `)} -`,"utf8")}function FIe(){return{command:"node",args:[EC]}}function $C(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- -`))return"failed";let i=bIe(e),o=/^name:\s*.*$/m.test(n)?n.replace(/^name:\s*.*$/m,`name: ${i}`):n.replace(/^---\n/,`--- +`,"utf8")}function UIe(){return{command:"node",args:[AC]}}function kC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- +`))return"failed";let i=wIe(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";F5(e,{recursive:!0,force:!0})}return aS(Ss(e)),mIe(t,e,{recursive:!0,dereference:!0}),ec(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,tc(t,`${JSON.stringify(i,null,2)} -`))}catch{return"failed"}}function LIe(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 $Ie)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 zIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(xC(),wC)),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,tc(t,i(s)))}catch{return"failed"}}function UIe(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 H5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function M5(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 TC(t={}){let e=t.home??L5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??B5(),i=t.version??G5(n),o=HIe(e),s=new Set(t.hosts??xIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",kC),l=H5(c),u=[],d=[];aS(r),MIe(r);let f=[tc(he(r,EC),NIe(n))];s.has("gemini")&&f.push(tc(he(r,AC),jIe()));let p=Ql(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?$C(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=FIe(),b=EIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?DIe(t.activate??!0):"unchanged",x={claude_plugin:Ql([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:PIe(e,b),codex_skills:AIe(e,b),codex_mcp:await OIe(e,b),cursor_mcp:RIe(e,b)},w=s.has("codex")?await zIe(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")?Ql([Mp(he(r,".agents","mcp_config.json"),g,a),IIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?Ql([$C(m,he(r,".claude","skills","cladding-init"),a),Mp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?Ql([$C(m,he(r,".cursor","skills","cladding-init"),a),Mp(he(r,".cursor","mcp.json"),g,a),LIe(he(r,".cursor","cli.json")),UIe(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))M5(J,X,u,d);for(let[X,J]of Object.entries(x))M5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${qIe(ae)} -`),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 qIe(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 B5(){let t=wIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function G5(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 fn(t=B5()){let e=G5(t);return e==="unknown"?null:e}function Z5(t=process.cwd()){return H5(he(ws(t),".cladding",kC))}function HIe(t=L5()){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 kC,EC,AC,xIe,$Ie,eu=y(()=>{"use strict";kC="setup-status.json",EC=he(".cladding","host","serve.cjs"),AC=".cladding/host/gemini-doctor-policy.toml",xIe=["claude","codex","gemini","antigravity","cursor"],$Ie=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as V5,readFileSync as W5}from"node:fs";import{join as K5}from"node:path";function J5(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 KIe(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 Y5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function X5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function JIe(t,e){let r=X5(t),n=X5(e);if(!r||!n)return!1;for(let i=0;iWIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(ZIe)?.[1],s=fn();return o!==void 0&&s!==null&&JIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function XIe(t){let e=K5(t,"README.md"),r=K5(t,"docs","dogfood","matrix.md");if(!V5(e)||!V5(r))return[];let n=W5(e,"utf8"),i=W5(r,"utf8"),o=J5(n,BIe),s=J5(i,GIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=Y5(d);if(f===null)continue;let p=s[u]??"not-run",m=KIe(p);m!==null&&f>m&&a.push({detector:OC,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=>Y5(u)!==null)?YIe(i,Date.now()):[];return l.length>0&&a.push({detector:OC,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 QIe(t){let{cwd:e="."}=t;return XIe(e)}var OC,BIe,GIe,ZIe,VIe,WIe,Q5,eY=y(()=>{"use strict";eu();OC="HOST_CLAIM_DRIFT",BIe=//,GIe=//,ZIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,VIe=/^- Generated:\s*(\S+)\s*$/m,WIe=720*60*60*1e3;Q5={name:OC,run:QIe}});function ePe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return tY(r.features.map(i=>i.id),"feature","spec/features/",n),tY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function tY(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:rY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var rY,nY,iY=y(()=>{"use strict";Ue();rY="ID_COLLISION";nY={name:rY,run:ePe}});import{existsSync as Lp,readFileSync as RC,readdirSync as IC,statSync as tPe,writeFileSync as sY}from"node:fs";import{join as To}from"node:path";function oY(t){if(!Lp(t))return 0;try{return IC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function rPe(t){if(!Lp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=IC(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=tPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function nPe(t){let e=To(t,"spec","capabilities.yaml");if(!Lp(e))return 0;try{let r=dS.default.parse(RC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=oY(To(t,"spec","features")),r=oY(To(t,"spec","scenarios")),n=nPe(t),i=rPe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function tu(t,e){let r=To(t,"spec.yaml");if(!Lp(r))return;let n=RC(r,"utf8"),i=iPe(n,e);i!==n&&sY(r,i)}function iPe(t,e){let r=t.includes(`\r +`);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";F5(e,{recursive:!0,force:!0})}return aS(Ss(e)),yIe(t,e,{recursive:!0,dereference:!0}),ec(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,tc(t,`${JSON.stringify(i,null,2)} +`))}catch{return"failed"}}function qIe(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 AIe)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 HIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>($C(),xC)),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,tc(t,i(s)))}catch{return"failed"}}function BIe(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 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 H5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function M5(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 OC(t={}){let e=t.home??L5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??B5(),i=t.version??G5(n),o=ZIe(e),s=new Set(t.hosts??EIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",EC),l=H5(c),u=[],d=[];aS(r),zIe(r);let f=[tc(he(r,AC),FIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),LIe()));let p=eu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?kC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=UIe(),b=OIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?MIe(t.activate??!0):"unchanged",x={claude_plugin:eu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:NIe(e,b),codex_skills:RIe(e,b),codex_mcp:await PIe(e,b),cursor_mcp:CIe(e,b)},w=s.has("codex")?await HIe(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),DIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?eu([kC(m,he(r,".claude","skills","cladding-init"),a),Mp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?eu([kC(m,he(r,".cursor","skills","cladding-init"),a),Mp(he(r,".cursor","mcp.json"),g,a),qIe(he(r,".cursor","cli.json")),BIe(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))M5(J,X,u,d);for(let[X,J]of Object.entries(x))M5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${GIe(ae)} +`),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 GIe(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 B5(){let t=kIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function G5(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 fn(t=B5()){let e=G5(t);return e==="unknown"?null:e}function Z5(t=process.cwd()){return H5(he(ws(t),".cladding",EC))}function ZIe(t=L5()){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 EC,AC,TC,EIe,AIe,tu=y(()=>{"use strict";EC="setup-status.json",AC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",EIe=["claude","codex","gemini","antigravity","cursor"],AIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as V5,readFileSync as W5}from"node:fs";import{join as K5}from"node:path";function J5(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 XIe(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 Y5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function X5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function QIe(t,e){let r=X5(t),n=X5(e);if(!r||!n)return!1;for(let i=0;iYIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(KIe)?.[1],s=fn();return o!==void 0&&s!==null&&QIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function tPe(t){let e=K5(t,"README.md"),r=K5(t,"docs","dogfood","matrix.md");if(!V5(e)||!V5(r))return[];let n=W5(e,"utf8"),i=W5(r,"utf8"),o=J5(n,VIe),s=J5(i,WIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=Y5(d);if(f===null)continue;let p=s[u]??"not-run",m=XIe(p);m!==null&&f>m&&a.push({detector:RC,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=>Y5(u)!==null)?ePe(i,Date.now()):[];return l.length>0&&a.push({detector:RC,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 rPe(t){let{cwd:e="."}=t;return tPe(e)}var RC,VIe,WIe,KIe,JIe,YIe,Q5,eY=y(()=>{"use strict";tu();RC="HOST_CLAIM_DRIFT",VIe=//,WIe=//,KIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,JIe=/^- Generated:\s*(\S+)\s*$/m,YIe=720*60*60*1e3;Q5={name:RC,run:rPe}});function nPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return tY(r.features.map(i=>i.id),"feature","spec/features/",n),tY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function tY(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:rY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var rY,nY,iY=y(()=>{"use strict";Ue();rY="ID_COLLISION";nY={name:rY,run:nPe}});import{existsSync as Lp,readFileSync as IC,readdirSync as PC,statSync as iPe,writeFileSync as sY}from"node:fs";import{join as To}from"node:path";function oY(t){if(!Lp(t))return 0;try{return PC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function oPe(t){if(!Lp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=PC(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=iPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function sPe(t){let e=To(t,"spec","capabilities.yaml");if(!Lp(e))return 0;try{let r=dS.default.parse(IC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=oY(To(t,"spec","features")),r=oY(To(t,"spec","scenarios")),n=sPe(t),i=oPe(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=IC(r,"utf8"),i=aPe(n,e);i!==n&&sY(r,i)}function aPe(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(!Lp(e))return!1;let r=[];for(let i of IC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(RC(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 rc(t="."){let e=To(t,"spec","features");if(!Lp(e))return!1;let r=[];for(let i of PC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(IC(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 sY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,zp=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as aY,readFileSync as cY,readdirSync as oPe}from"node:fs";import{join as PC}from"node:path";function sPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=lY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return CC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...CC(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 lY){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(...CC(e)),o}function CC(t){let e=PC(t,"spec","index.yaml"),r=PC(t,"spec","features");if(!aY(e)||!aY(r))return[];let n=new Map;try{for(let l of cY(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 oPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=cY(PC(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,lY,uY,dY=y(()=>{"use strict";zp();Ue();Up="INVENTORY_DRIFT",lY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];uY={name:Up,run:sPe}});import{existsSync as aPe,readFileSync as cPe}from"node:fs";import{join as lPe}from"node:path";function dPe(t){let{cwd:e="."}=t,r=lPe(e,"src","spec","schema.json"),n=[];if(aPe(r)){let i;try{i=JSON.parse(cPe(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 uPe)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!==fY&&n.push({detector:qp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${fY}'`})}catch{}return n}var qp,uPe,fY,pY,mY=y(()=>{"use strict";Ue();qp="META_INTEGRITY",uPe=["schema","project","features"],fY="0.1";pY={name:qp,run:dPe}});function fPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return hY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),hY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function hY(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:gY,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 gY,yY,_Y=y(()=>{"use strict";Ue();gY="SLUG_CONFLICT";yY={name:gY,run:fPe}});function ru(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as pPe}from"node:fs";import{join as mPe}from"node:path";function hPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>gPe(r,e))}function gPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=mPe(e,i);pPe(o)||r.push(yPe(n.id,i,n.status))}return r}function yPe(t,e,r){return ru(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,DC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:hPe}});function _Pe(t){let{cwd:e="."}=t;return ye(e,NC,bPe)}function bPe(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:NC,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 NC,hS,jC=y(()=>{"use strict";xt();NC="MISSING_TESTS";hS={name:NC,run:_Pe}});import{existsSync as vPe,readFileSync as SPe}from"node:fs";import{join as bY}from"node:path";function vY(t){if(vPe(t))try{return JSON.parse(SPe(t,"utf8"))}catch{return}}function kPe(t){let{cwd:e="."}=t,r=vY(bY(e,wPe)),n=vY(bY(e,xPe));if(!r||!n)return[{detector:MC,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>$Pe&&i.push({detector:MC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var MC,wPe,xPe,$Pe,SY,wY=y(()=>{"use strict";MC="PERFORMANCE_DRIFT",wPe="perf/baseline.json",xPe="perf/current.json",$Pe=10;SY={name:MC,run:kPe}});import{existsSync as EPe}from"node:fs";import{join as APe}from"node:path";function OPe(t){let{cwd:e="."}=t;return ye(e,FC,r=>IPe(r,e))}function RPe(t,e){return(t.modules??[]).some(r=>EPe(APe(e,r)))}function IPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||RPe(s,e)||r.push(s.id);let n=TPe;if(r.length<=n)return[];let i=r.slice(0,xY).join(", "),o=r.length>xY?", \u2026":"";return[{detector:FC,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 FC,TPe,xY,$Y,kY=y(()=>{"use strict";xt();FC="PLANNED_BACKLOG",TPe=5,xY=8;$Y={name:FC,run:OPe}});import{existsSync as PPe,readFileSync as CPe}from"node:fs";import{join as DPe}from"node:path";function MPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>FPe(r,e))}function FPe(t,e){if(t.features.lengthn.includes(i))?[{detector:LC,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 LC,NPe,jPe,EY,AY=y(()=>{"use strict";xt();LC="PROJECT_CONTEXT_DRIFT",NPe=8,jPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];EY={name:LC,run:MPe}});function TY(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:gS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function LPe(t){let{cwd:e="."}=t;return ye(e,gS,zPe)}function zPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...TY(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(...TY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,zC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:LPe}});function Hp(t=""){return new RegExp(UPe,t)}var UPe,UC=y(()=>{"use strict";UPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as qPe,readdirSync as HPe,readFileSync as BPe,statSync as GPe,writeFileSync as ZPe}from"node:fs";import{dirname as VPe,join as Bp,normalize as WPe,relative as KPe}from"node:path";function eCe(t){let e=[];for(let r of t.matchAll(QPe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Hp("g"))??[])e.push(n);return[...new Set(e)].sort()}function tCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function OY(t){return t.split("\\").join("/")}function rCe(t){return JPe.some(e=>t===e||t.startsWith(`${e}/`))}function nCe(t){let e=Bp(t,"docs");if(!qPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=HPe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Bp(i,s),c;try{c=GPe(a)}catch{continue}let l=OY(KPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function iCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=WPe(Bp(VPe(t),e));return OY(r)}function Gp(t="."){let e=[];for(let r of nCe(t)){let n;try{n=BPe(Bp(t,r),"utf8")}catch{continue}let i=tCe(n),o=eCe(i);if(rCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(YPe)?[]:i.match(Hp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(XPe)){let d=iCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function RY(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 ZPe(Bp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return sY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,zp=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as aY,readFileSync as cY,readdirSync as cPe}from"node:fs";import{join as CC}from"node:path";function lPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=lY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return DC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...DC(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 lY){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(...DC(e)),o}function DC(t){let e=CC(t,"spec","index.yaml"),r=CC(t,"spec","features");if(!aY(e)||!aY(r))return[];let n=new Map;try{for(let l of cY(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 cPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=cY(CC(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,lY,uY,dY=y(()=>{"use strict";zp();Ue();Up="INVENTORY_DRIFT",lY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];uY={name:Up,run:lPe}});import{existsSync as uPe,readFileSync as dPe}from"node:fs";import{join as fPe}from"node:path";function mPe(t){let{cwd:e="."}=t,r=fPe(e,"src","spec","schema.json"),n=[];if(uPe(r)){let i;try{i=JSON.parse(dPe(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 pPe)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!==fY&&n.push({detector:qp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${fY}'`})}catch{}return n}var qp,pPe,fY,pY,mY=y(()=>{"use strict";Ue();qp="META_INTEGRITY",pPe=["schema","project","features"],fY="0.1";pY={name:qp,run:mPe}});function hPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return hY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),hY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function hY(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:gY,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 gY,yY,_Y=y(()=>{"use strict";Ue();gY="SLUG_CONFLICT";yY={name:gY,run:hPe}});function nu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as gPe}from"node:fs";import{join as yPe}from"node:path";function _Pe(t){let{cwd:e="."}=t;return ye(e,pS,r=>bPe(r,e))}function bPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=yPe(e,i);gPe(o)||r.push(vPe(n.id,i,n.status))}return r}function vPe(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,NC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:_Pe}});function SPe(t){let{cwd:e="."}=t;return ye(e,jC,wPe)}function wPe(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:jC,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 jC,hS,MC=y(()=>{"use strict";xt();jC="MISSING_TESTS";hS={name:jC,run:SPe}});import{existsSync as xPe,readFileSync as $Pe}from"node:fs";import{join as bY}from"node:path";function vY(t){if(xPe(t))try{return JSON.parse($Pe(t,"utf8"))}catch{return}}function TPe(t){let{cwd:e="."}=t,r=vY(bY(e,kPe)),n=vY(bY(e,EPe));if(!r||!n)return[{detector:FC,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>APe&&i.push({detector:FC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var FC,kPe,EPe,APe,SY,wY=y(()=>{"use strict";FC="PERFORMANCE_DRIFT",kPe="perf/baseline.json",EPe="perf/current.json",APe=10;SY={name:FC,run:TPe}});import{existsSync as OPe}from"node:fs";import{join as RPe}from"node:path";function PPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>DPe(r,e))}function CPe(t,e){return(t.modules??[]).some(r=>OPe(RPe(e,r)))}function DPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||CPe(s,e)||r.push(s.id);let n=IPe;if(r.length<=n)return[];let i=r.slice(0,xY).join(", "),o=r.length>xY?", \u2026":"";return[{detector:LC,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 LC,IPe,xY,$Y,kY=y(()=>{"use strict";xt();LC="PLANNED_BACKLOG",IPe=5,xY=8;$Y={name:LC,run:PPe}});import{existsSync as NPe,readFileSync as jPe}from"node:fs";import{join as MPe}from"node:path";function zPe(t){let{cwd:e="."}=t;return ye(e,zC,r=>UPe(r,e))}function UPe(t,e){if(t.features.lengthn.includes(i))?[{detector:zC,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 zC,FPe,LPe,EY,AY=y(()=>{"use strict";xt();zC="PROJECT_CONTEXT_DRIFT",FPe=8,LPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];EY={name:zC,run:zPe}});function TY(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:gS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function qPe(t){let{cwd:e="."}=t;return ye(e,gS,HPe)}function HPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...TY(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(...TY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,UC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:qPe}});function Hp(t=""){return new RegExp(BPe,t)}var BPe,qC=y(()=>{"use strict";BPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as GPe,readdirSync as ZPe,readFileSync as VPe,statSync as WPe,writeFileSync as KPe}from"node:fs";import{dirname as JPe,join as Bp,normalize as YPe,relative as XPe}from"node:path";function nCe(t){let e=[];for(let r of t.matchAll(rCe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Hp("g"))??[])e.push(n);return[...new Set(e)].sort()}function iCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function OY(t){return t.split("\\").join("/")}function oCe(t){return QPe.some(e=>t===e||t.startsWith(`${e}/`))}function sCe(t){let e=Bp(t,"docs");if(!GPe(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=WPe(a)}catch{continue}let l=OY(XPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function aCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=YPe(Bp(JPe(t),e));return OY(r)}function Gp(t="."){let e=[];for(let r of sCe(t)){let n;try{n=VPe(Bp(t,r),"utf8")}catch{continue}let i=iCe(n),o=nCe(i);if(oCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(eCe)?[]:i.match(Hp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(tCe)){let d=aCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function RY(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 KPe(Bp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var JPe,YPe,XPe,QPe,_S=y(()=>{"use strict";UC();JPe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],YPe="clad-doc-links: ignore",XPe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,QPe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as oCe}from"node:fs";import{join as sCe}from"node:path";function aCe(t){let{cwd:e="."}=t;return ye(e,bS,r=>cCe(r,e))}function cCe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Gp(e).docs){for(let o of i.doc_links)oCe(sCe(e,o))||n.push({detector:bS,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:bS,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 bS,vS,qC=y(()=>{"use strict";_S();xt();bS="DOC_LINK_INTEGRITY";vS={name:bS,run:aCe}});function lCe(t){let{cwd:e="."}=t;return ye(e,Zp,r=>uCe(r))}function uCe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=IY,o=t.project.onboarding_seeded===!0&&!i;r>=IY&&n.length===0&&e.push({detector:Zp,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:Zp,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:Zp,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 Zp,IY,PY,CY=y(()=>{"use strict";xt();Zp="SCENARIO_COVERAGE",IY=8;PY={name:Zp,run:lCe}});import{createHash as dCe}from"node:crypto";function fCe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Vp(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??DY),sample:fCe(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(DY),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Wp(t){return(t.features??[]).filter(e=>e.status==="done").length}function pCe(t,e){return e<=0?!1:e>=1?!0:parseInt(dCe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var DY,SS=y(()=>{"use strict";DY=["unwanted"]});import{chmodSync as mCe,existsSync as jY,readFileSync as hCe,readdirSync as gCe,statSync as MY,unlinkSync as yCe,utimesSync as _Ce,writeFileSync as bCe}from"node:fs";import{join as FY}from"node:path";import LY from"node:process";function vCe(t){return TJ(t).map(e=>{try{let r=MY(e);return r.isFile()?{path:e,body:hCe(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 SCe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!jY(r.path))continue;if(!MY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}yCe(r.path);continue}bCe(r.path,r.body),r.mode!==void 0&&mCe(r.path,r.mode),r.atime&&r.mtime&&_Ce(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function wCe(t){let e=!1,r=n=>{for(let i of gCe(n,{withFileTypes:!0})){if(e)return;let o=FY(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 HC(t={}){let{cwd:e="."}=t,r=FY(e,$s);if(!jY(r)||!wCe(r))return{stage:nc,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${$s}/ \u2014 skipped`};let n=_t(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=vCe(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=SCe(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,xCe,BC=y(()=>{"use strict";zr();Dn();vp();Nn();nc="stage_2.3",$s="tests/oracle";xCe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${LY.argv[1]}`;if(xCe){let t=HC();console.log(JSON.stringify(t)),LY.exit(t.exitCode)}});import{existsSync as $Ce}from"node:fs";import{join as kCe}from"node:path";function ECe(t){let{cwd:e="."}=t;return ye(e,ai,r=>ACe(r,e))}function ACe(t,e){let r=[],n=Vp(t.project,Wp(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(Kp(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(!$Ce(kCe(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,zY,UY=y(()=>{"use strict";un();SS();BC();xt();ai="SPEC_CONFORMANCE";zY={name:ai,run:ECe}});function TCe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:GC,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>qY&&i.push({detector:GC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${qY})`})}return i}var GC,qY,HY,BY=y(()=>{"use strict";un();GC="STALE_EVIDENCE",qY=90;HY={name:GC,run:TCe}});import{existsSync as GY}from"node:fs";import{join as ZY}from"node:path";function OCe(t){let{cwd:e="."}=t;return ye(e,nu,r=>RCe(r,e))}function RCe(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=>GY(ZY(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=>GY(ZY(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,wS,ZC=y(()=>{"use strict";fS();xt();nu="STALE_SPECIFICATION";wS={name:nu,run:OCe}});import{existsSync as VY,statSync as WY}from"node:fs";import{join as KY}from"node:path";function PCe(t,e){let r=0;for(let n of e){let i=KY(t,n);if(!VY(i))continue;let o=WY(i).mtimeMs;o>r&&(r=o)}return r}function CCe(t){let{cwd:e="."}=t;return ye(e,VC,r=>DCe(r,e))}function DCe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=PCe(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=KY(e,a);if(!VY(c))continue;let l=WY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>ICe&&s.push({detector:VC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var VC,ICe,xS,WC=y(()=>{"use strict";Op();Va();xt();VC="STALE_TESTS",ICe=30;xS={name:VC,run:CCe}});import{existsSync as NCe}from"node:fs";import{join as jCe}from"node:path";function MCe(t){let{cwd:e="."}=t;return ye(e,Jp,r=>FCe(r,e))}function FCe(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:Jp,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=>!NCe(jCe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Jp,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:Jp,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 Jp,$S,KC=y(()=>{"use strict";fS();xt();Jp="STATUS_DRIFT";$S={name:Jp,run:MCe}});import{readdirSync as LCe}from"node:fs";import{extname as zCe,join as UCe}from"node:path";function YY(t,e={}){let r=e.maxFiles!==void 0&&e.maxFiles>=1?e.maxFiles:HCe,n={},i=0,o=0,s=[t];for(;s.length>0&&o=r)break;o+=1;let f=iu[zCe(d.name).toLowerCase()];f!==void 0&&(n[f]=(n[f]??0)+1,i+=1)}}let a=Object.keys(n).sort(),c=null;for(let l of a)(c===null||n[l]>n[c])&&(c=l);return{counts:n,classified:i,set:a,dominant:c,share(l){return i===0?0:(n[l]??0)/i}}}var iu,JY,qCe,HCe,JC=y(()=>{"use strict";iu={".ts":"typescript",".tsx":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".kt":"kotlin",".kts":"kotlin",".cs":"csharp",".rb":"ruby",".php":"php",".swift":"swift",".ex":"elixir",".exs":"elixir",".scala":"scala",".dart":"dart",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".h":"cpp"},JY=new Set(Object.values(iu)),qCe=new Set(["node_modules",".git","dist","build","out","coverage","target","vendor",".cladding"]),HCe=2e4});function ZCe(t){let{cwd:e="."}=t;return ye(e,kS,r=>WCe(r,e))}function VCe(t){return`{${Object.keys(t).sort((r,n)=>t[n]-t[r]||r.localeCompare(n)).map(r=>`${r} \xD7${t[r]}`).join(", ")}}`}function WCe(t,e){let r=t.project?.language??"";if(!JY.has(r))return[];let n=YY(e);return n.classified{"use strict";JC();xt();kS="TECH_STACK_MISMATCH",BCe=5,GCe=.1;XY={name:kS,run:ZCe}});function XCe(t){if((t.features??[]).length`${i}/${o}/**/*.${n}`)}function QCe(t){let{cwd:e="."}=t;return ye(e,YC,r=>eDe(r,e))}function eDe(t,e){let r=new Set;for(let o of t.features)for(let s of o.modules??[])r.add(s);let n=vs([...XCe(t)],{cwd:e,dot:!1}),i=[];for(let o of n)r.has(o)||i.push({detector:YC,severity:"error",path:o,message:`file '${o}' is not claimed by any feature in spec.yaml`});return i}var YC,eX,KCe,JCe,YCe,ES,XC=y(()=>{"use strict";Op();iC();xt();YC="UNMAPPED_ARTIFACT",eX=["src/stages/**/*.ts","src/spec/**/*.ts"],KCe={typescript:"ts",javascript:"js",python:"py",rust:"rs",go:"go",kotlin:"kt"},JCe={kotlin:"src/main/kotlin"},YCe=8;ES={name:YC,run:QCe}});import{existsSync as tX}from"node:fs";import{join as rX}from"node:path";function rDe(t){return tDe.some(e=>t.startsWith(e))}function nDe(t){let{cwd:e="."}=t;return ye(e,QC,r=>iDe(r,e))}function iDe(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(rDe(o))continue;let s=o.split("#",1)[0];tX(rX(e,o))||s&&tX(rX(e,s))||r.push({detector:QC,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: +`}function Wx(t){return`${JSON.stringify(t,null,2)} +`}function Jte(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${Zte(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(Vte);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(Vte);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${Zte(s)}.md`,`${a.join(` +`)}`)}return o}function Vte(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as I4e}from"node:fs";import{dirname as P4e,join as Zj}from"node:path";import{fileURLToPath as C4e}from"node:url";var Vj=P4e(C4e(import.meta.url));function Yte(t){for(let e of[Zj(Vj,"viewer",t),Zj(Vj,"..","graph","viewer",t),Zj(Vj,"..","..","dist","viewer",t)])try{return I4e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function Xte(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -922,21 +922,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}cC();qC();DC();jC();zC();aC();WC();KC();XC();eD();oh();UC();Ue();var O4e=[hS,AS,mS,ES,yS,vS,tS,$S,xS,eS];function R4e(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 Kx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of O4e){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 R4e(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}Wj();Ue();Pi();var P4e=new Set(["mermaid","dot","json","obsidian","html"]);function Yte(t={}){try{let e=t.format??"mermaid";if(!P4e.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=Hx(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=qx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Vte(i);for(let[c,l]of a){let u=I4e(s,c);Kj(Yj(u),{recursive:!0}),Jj(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=Wx(i,Kx(i,"."));Kj(Yj(t.out),{recursive:!0}),Jj(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"?Zte(i):r==="json"?Vx(i):Gte(i);t.out?(Kj(Yj(t.out),{recursive:!0}),Jj(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 Xte(){try{let t=kc(q(),".");process.stdout.write(Jte(Jx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as C4e}from"node:http";import{existsSync as D4e,watch as N4e}from"node:fs";import{join as j4e}from"node:path";Ue();Pi();function M4e(t={}){let e=t.cwd??".",r=new Set,n=()=>kc(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}lC();HC();NC();MC();UC();cC();KC();JC();XC();eD();oh();qC();Ue();var D4e=[hS,TS,mS,AS,yS,vS,tS,$S,xS,eS];function N4e(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 Jx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of D4e){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 N4e(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}Wj();Ue();Pi();var M4e=new Set(["mermaid","dot","json","obsidian","html"]);function ere(t={}){try{let e=t.format??"mermaid";if(!M4e.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=Bx(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=Hx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Jte(i);for(let[c,l]of a){let u=j4e(s,c);Kj(Yj(u),{recursive:!0}),Jj(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=Kx(i,Jx(i,"."));Kj(Yj(t.out),{recursive:!0}),Jj(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"?Kte(i):r==="json"?Wx(i):Wte(i);t.out?(Kj(Yj(t.out),{recursive:!0}),Jj(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 tre(){try{let t=Ec(q(),".");process.stdout.write(Qte(Yx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as F4e}from"node:http";import{existsSync as L4e,watch as z4e}from"node:fs";import{join as U4e}from"node:path";Ue();Pi();function q4e(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=C4e((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=Vx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Kx(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 +`)}catch{r.delete(u)}},o=F4e((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=Wx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Jx(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=Wx(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=j4e(e,u);if(D4e(d))try{let f=N4e(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 +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Kx(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=U4e(e,u);if(L4e(d))try{let f=z4e(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 Qte(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await M4e({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 F4e=["stage_1.1","stage_2.1","stage_2.3"];function L4e(t){return(t.features??[]).filter(e=>e.status==="done")}function z4e(t,e){let r=L4e(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 ere(t,e){let r=[];for(let n of F4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=z4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}CS();import tre from"node:process";function U4e(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 Yx(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=U4e(n,t);i.pass||r.push(i)}return r}un();var Xj="stage_4.1";function Qj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Xj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Yx(r);if(n.length===0)return{stage:Xj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Xj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var q4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${tre.argv[1]}`;if(q4e){let t=Qj();console.log(JSON.stringify(t)),tre.exit(t.exitCode)}kl();import{randomBytes as H4e}from"node:crypto";import{unlinkSync as B4e}from"node:fs";import{tmpdir as G4e}from"node:os";import{join as Z4e,resolve as eM}from"node:path";import V4e from"node:process";var Gr=null;function rre(t){Gr={cwd:eM(t),run:null,jsonFile:null}}function tM(){return Gr!==null}function rM(t,e){if(!Gr||Gr.cwd!==eM(t))return null;if(Gr.run)return Gr.run;let r=Z4e(G4e(),`clad-shared-vitest-${V4e.pid}-${H4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function nre(t){return!Gr||Gr.cwd!==eM(t)?null:Gr.run}function nM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function ire(){let t=Gr?.jsonFile;if(Gr=null,t)try{B4e(t)}catch{}}zr();import ore from"node:process";var Xx="stage_1.4";function iM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Xx,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:Xx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Xx,pass:!0,exitCode:0}:{stage:Xx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var W4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ore.argv[1]}`;if(W4e){let t=iM();console.log(JSON.stringify(t)),ore.exit(t.exitCode)}zr();import sre from"node:process";sh();Nn();var Qx="stage_2.2";function oM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:Qx,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:Qx,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=nre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(Qx,r,s,n);return a||Xt(Qx,s)}var Y4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${sre.argv[1]}`;if(Y4e){let t=oM();console.log(JSON.stringify(t)),sre.exit(t.exitCode)}Xp();aD();sM();zr();Dn();Nn();import cre from"node:process";var r0="stage_3.2";function aM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:r0,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:r0,pass:!1,exitCode:2,stderr:"perf 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 yHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(yHe){let t=aM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as _He}from"node:fs";import{resolve as ure}from"node:path";import dre from"node:process";var fi="stage_2.4",cM=5e3,bHe=3e4;function lM(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 SHe(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=ure(e,r.path);if(!_He(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??cM,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 lre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},vHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function SHe(t,e,r){let n=Math.min(e.length*cM,bHe),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(wHe(t,s,r))}return xHe(o)}function wHe(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("/")?ure(t,a):a,u=cM,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 xHe(t){let e="skip";for(let o of t)lre[o.disposition]>lre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${vHe[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 $He=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dre.argv[1]}`;if($He){let t=lM();console.log(JSON.stringify(t)),dre.exit(t.exitCode)}zr();Dn();Nn();import fre from"node:process";var n0="stage_3.1";function uM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,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:n0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var kHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(kHe){let t=uM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}BC();dM();fM();zr();e0();import{randomBytes as PHe}from"node:crypto";import{unlinkSync as CHe}from"node:fs";import{tmpdir as DHe}from"node:os";import{join as NHe}from"node:path";import mM from"node:process";sh();Nn();Ue();import{readFileSync as THe}from"node:fs";import{resolve as hre}from"node:path";function OHe(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=hre(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 RHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function IHe(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=RHe(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(hre(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 pM(t,e){try{let r=OHe(THe(t,"utf8"));return r?IHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function gre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function yre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function _re(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 jHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!gre(n,i))return null;let o=n,s=i,a=rM(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(nM(u)==="fallback")return null;if(r){let d=pM(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 MHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!yre(n,i))return null;let o=n,s=i,a=rM(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(nM(c)==="fallback")return null;if(r&&_re(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 hM(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=gre(n,i),a=yre(n,i),c=r&&s;if(tM()&&s){let d=jHe(t,e,c);if(d)return d}if(tM()&&a){let d=MHe(t,e);if(d)return d}let l,u=i;c&&(l=NHe(DHe(),`clad-vitest-${mM.pid}-${PHe(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=Fu("unit",Xt(Zr,d),d);if(r&&p.pass&&_re(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=pM(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{CHe(l)}catch{}}}var FHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mM.argv[1]}`;if(FHe){let t=hM();console.log(JSON.stringify(t)),mM.exit(t.exitCode)}zr();Dn();Nn();import bre from"node:process";var s0="stage_3.3";function gM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:s0,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:s0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(s0,i,s,o);return a||Xt(s0,s)}var LHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(LHe){let t=gM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}ZC();Gf();wa();_M();zp();_S();var Ere=wt(tr(),1);import{existsSync as bM,readFileSync as JHe,readdirSync as kre,statSync as YHe,writeFileSync as XHe}from"node:fs";import{basename as dh,join as fh,relative as $re}from"node:path";var QHe=["self-dogfood:","fixture:","derived:"],Are=/\.(test|spec)\.[jt]sx?$/;function Tre(t,e=t,r=[]){let n;try{n=kre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{YHe(o).isDirectory()?Tre(t,o,r):Are.test(i)&&r.push(o)}catch{continue}}return r}function Ore(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!bM(e)||!bM(r))return{repaired:n,suggested:i};let o=Tre(r),s=new Map;for(let a of o){let c=$re(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of kre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=JHe(c,"utf8"),u=(0,Ere.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(bM(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=>$re(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Are,"");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 rre(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await q4e({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 H4e=["stage_1.1","stage_2.1","stage_2.3"];function B4e(t){return(t.features??[]).filter(e=>e.status==="done")}function G4e(t,e){let r=B4e(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 nre(t,e){let r=[];for(let n of H4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=G4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}DS();import ire from"node:process";function Z4e(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 Xx(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=Z4e(n,t);i.pass||r.push(i)}return r}un();var Xj="stage_4.1";function Qj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Xj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Xx(r);if(n.length===0)return{stage:Xj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Xj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var V4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ire.argv[1]}`;if(V4e){let t=Qj();console.log(JSON.stringify(t)),ire.exit(t.exitCode)}El();import{randomBytes as W4e}from"node:crypto";import{unlinkSync as K4e}from"node:fs";import{tmpdir as J4e}from"node:os";import{join as Y4e,resolve as eM}from"node:path";import X4e from"node:process";var Gr=null;function ore(t){Gr={cwd:eM(t),run:null,jsonFile:null}}function tM(){return Gr!==null}function rM(t,e){if(!Gr||Gr.cwd!==eM(t))return null;if(Gr.run)return Gr.run;let r=Y4e(J4e(),`clad-shared-vitest-${X4e.pid}-${W4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function sre(t){return!Gr||Gr.cwd!==eM(t)?null:Gr.run}function nM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function are(){let t=Gr?.jsonFile;if(Gr=null,t)try{K4e(t)}catch{}}zr();import cre from"node:process";var Qx="stage_1.4";function iM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Qx,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:Qx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Qx,pass:!0,exitCode:0}:{stage:Qx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var Q4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(Q4e){let t=iM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();import lre from"node:process";sh();Nn();var e0="stage_2.2";function oM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:e0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:e0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=sre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(e0,r,s,n);return a||Xt(e0,s)}var rHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lre.argv[1]}`;if(rHe){let t=oM();console.log(JSON.stringify(t)),lre.exit(t.exitCode)}Xp();aD();sM();zr();Dn();Nn();import dre from"node:process";var n0="stage_3.2";function aM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,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:n0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var wHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dre.argv[1]}`;if(wHe){let t=aM();console.log(JSON.stringify(t)),dre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as xHe}from"node:fs";import{resolve as pre}from"node:path";import mre from"node:process";var fi="stage_2.4",cM=5e3,$He=3e4;function lM(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 EHe(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=pre(e,r.path);if(!xHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??cM,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 fre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},kHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function EHe(t,e,r){let n=Math.min(e.length*cM,$He),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(AHe(t,s,r))}return THe(o)}function AHe(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("/")?pre(t,a):a,u=cM,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 THe(t){let e="skip";for(let o of t)fre[o.disposition]>fre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${kHe[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 OHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mre.argv[1]}`;if(OHe){let t=lM();console.log(JSON.stringify(t)),mre.exit(t.exitCode)}zr();Dn();Nn();import hre from"node:process";var i0="stage_3.1";function uM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,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:i0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var RHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hre.argv[1]}`;if(RHe){let t=uM();console.log(JSON.stringify(t)),hre.exit(t.exitCode)}GC();dM();fM();zr();t0();import{randomBytes as MHe}from"node:crypto";import{unlinkSync as FHe}from"node:fs";import{tmpdir as LHe}from"node:os";import{join as zHe}from"node:path";import mM from"node:process";sh();Nn();Ue();import{readFileSync as CHe}from"node:fs";import{resolve as _re}from"node:path";function DHe(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=_re(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 NHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function jHe(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=NHe(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(_re(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 pM(t,e){try{let r=DHe(CHe(t,"utf8"));return r?jHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function bre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function vre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Sre(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 UHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!bre(n,i))return null;let o=n,s=i,a=rM(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(nM(u)==="fallback")return null;if(r){let d=pM(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 qHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!vre(n,i))return null;let o=n,s=i,a=rM(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(nM(c)==="fallback")return null;if(r&&Sre(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 hM(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=bre(n,i),a=vre(n,i),c=r&&s;if(tM()&&s){let d=UHe(t,e,c);if(d)return d}if(tM()&&a){let d=qHe(t,e);if(d)return d}let l,u=i;c&&(l=zHe(LHe(),`clad-vitest-${mM.pid}-${MHe(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=Fu("unit",Xt(Zr,d),d);if(r&&p.pass&&Sre(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=pM(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{FHe(l)}catch{}}}var HHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mM.argv[1]}`;if(HHe){let t=hM();console.log(JSON.stringify(t)),mM.exit(t.exitCode)}zr();Dn();Nn();import wre from"node:process";var a0="stage_3.3";function gM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:a0,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:a0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(a0,i,s,o);return a||Xt(a0,s)}var BHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(BHe){let t=gM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}VC();Gf();wa();_M();zp();_S();var Ore=wt(tr(),1);import{existsSync as bM,readFileSync as t6e,readdirSync as Tre,statSync as r6e,writeFileSync as n6e}from"node:fs";import{basename as dh,join as fh,relative as Are}from"node:path";var i6e=["self-dogfood:","fixture:","derived:"],Rre=/\.(test|spec)\.[jt]sx?$/;function Ire(t,e=t,r=[]){let n;try{n=Tre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{r6e(o).isDirectory()?Ire(t,o,r):Rre.test(i)&&r.push(o)}catch{continue}}return r}function Pre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!bM(e)||!bM(r))return{repaired:n,suggested:i};let o=Ire(r),s=new Map;for(let a of o){let c=Are(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of Tre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=t6e(c,"utf8"),u=(0,Ore.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(i6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(bM(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=>Are(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Rre,"");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&&XHe(c,l,"utf8")}return{repaired:n,suggested:i}}$l();import{existsSync as e6e,readFileSync as t6e}from"node:fs";import{join as r6e}from"node:path";function n6e(t,e){let r=r6e(t,e);if(!e6e(r))return[];let n=[];for(let i of t6e(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 Rre(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=>n6e(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 Ire(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();un();Pi();un();$l();var vM=["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"],i6e=[...vM,"att"];function o6e(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 Yx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function s6e(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 u0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...vM.map(o=>o6e(i,o,e)),s6e(i,r,e)]}));return{columns:i6e,rows:n}}function Pre(t,e=".",r={}){let n=r.internal??!1,i=u0(t,e),o=[...vM.map(c=>n?c.replace("stage_",""):a6e(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 a6e(t){return Ra(t).slice(0,3)}async function FYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Zde(),Gde)),Promise.resolve().then(()=>(Yde(),Jde)),Promise.resolve().then(()=>(cm(),aQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Mte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Nte(s,a,c),initialize:Nj,prepareClarify:(s,{cwd:a})=>jte(a,s),clarify:Lj,resolveReview:(s,{cwd:a})=>Ite(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 LYe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Nj({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)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&n6e(c,l,"utf8")}return{repaired:n,suggested:i}}kl();import{existsSync as o6e,readFileSync as s6e}from"node:fs";import{join as a6e}from"node:path";function c6e(t,e){let r=a6e(t,e);if(!o6e(r))return[];let n=[];for(let i of s6e(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 Cre(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=>c6e(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 Dre(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();un();Pi();un();kl();var vM=["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"],l6e=[...vM,"att"];function u6e(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 Xx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function d6e(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 d0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...vM.map(o=>u6e(i,o,e)),d6e(i,r,e)]}));return{columns:l6e,rows:n}}function Nre(t,e=".",r={}){let n=r.internal??!1,i=d0(t,e),o=[...vM.map(c=>n?c.replace("stage_",""):f6e(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 f6e(t){return Ra(t).slice(0,3)}async function HYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kde(),Wde)),Promise.resolve().then(()=>(efe(),Qde)),Promise.resolve().then(()=>(cm(),uQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>zte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Fte(s,a,c),initialize:Nj,prepareClarify:(s,{cwd:a})=>Lte(a,s),clarify:Lj,resolveReview:(s,{cwd:a})=>Dte(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 BYe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Nj({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: `);for(let[o,s]of n.clarifyingQuestions.entries())H.stdout.write(` ${o+1}. ${s} @@ -947,28 +947,28 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&XHe(c,l,"u `),H.stdout.write(` e.g. clad init payment SaaS for B2B `),H.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));H.exit(0)}async function zYe(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(()=>(wfe(),Sfe)),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=>gR(l,s)),c=`${jG(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 UYe(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("."),RY(".");let n=cu(".");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=Ore(".");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=l0(".");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 qYe(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 HYe(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.exit(0)}async function GYe(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(()=>(kfe(),$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=>yR(l,s)),c=`${jG(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 ZYe(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(".");ru(".",r),rc("."),RY(".");let n=cu(".");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=Pre(".");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=u0(".");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 VYe(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 WYe(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 BYe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await TC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function GYe(){L("note","update","reconciling the current project after the engine upgrade");let t=await P7(".",{wireHosts:async()=>(await TC({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(` +`),H.exit(0)}async function KYe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await OC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function JYe(){L("note","update","reconciling the current project after the engine upgrade");let t=await N7(".",{wireHosts:async()=>(await OC({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): -`),MA({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 ZYe={"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 MA(t){let e=t.tier??"all",r=t.silent===!0,n=ZYe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",iM],["stage_1.5",sc],["stage_1.6",rm],["stage_2.1",()=>hM({...i,strict:t.strict})],["stage_2.2",()=>oM(i)],["stage_2.3",HC],["stage_2.4",lM],["stage_3.1",uM],["stage_3.2",aM],["stage_3.3",gM],["stage_4.1",Qj],["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("."),rre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=yX(p);mr(h)&&(c=!0,a=Math.max(a,_X(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)&&eXe(p))}}finally{rb(),ire()}if(t.strict)try{let d=q();for(let f of ere(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{sZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:iZ(OS)})&&(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:RS(u),stopFingerprint:bX(u)}),{worst:a,anyFailed:c,stages:u}}function VYe(t){try{let e=q(),r=yl(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 WYe(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 KYe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=TS(e,o=>{try{return xfe(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 JYe(t={}){try{if(t.sessions){zte(t);return}if(t.trend!==void 0&&t.trend!==!1){Ute(t);return}let e=q(),n=tG(e,o=>{try{return xfe(o,"utf8")}catch{return null}},"."),i=nG(".",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(` +`),FA({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 YYe={"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 FA(t){let e=t.tier??"all",r=t.silent===!0,n=YYe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",iM],["stage_1.5",ac],["stage_1.6",rm],["stage_2.1",()=>hM({...i,strict:t.strict})],["stage_2.2",()=>oM(i)],["stage_2.3",BC],["stage_2.4",lM],["stage_3.1",uM],["stage_3.2",aM],["stage_3.3",gM],["stage_4.1",Qj],["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("."),ore(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=vX(p);mr(h)&&(c=!0,a=Math.max(a,SX(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)&&oXe(p))}}finally{rb(),are()}if(t.strict)try{let d=q();for(let f of nre(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{sZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:iZ(RS)})&&(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:IS(u),stopFingerprint:wX(u)}),{worst:a,anyFailed:c,stages:u}}function XYe(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 QYe(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 eXe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=OS(e,o=>{try{return Efe(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 tXe(t={}){try{if(t.sessions){Hte(t);return}if(t.trend!==void 0&&t.trend!==!1){Bte(t);return}let e=q(),n=tG(e,o=>{try{return Efe(o,"utf8")}catch{return null}},"."),i=nG(".",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)}`,` ${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 YYe(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=MA({...t,focusModules:e});if(!t.json){let n=e7(".");n&&H.stdout.write(`\u2139 ${n} -`)}H.exitCode=r.worst}function XYe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=ZX(".",t,{checkStages:MA,onIndex:rc,gitOpInProgress:FO,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}') +`),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 rXe(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=FA({...t,focusModules:e});if(!t.json){let n=n7(".");n&&H.stdout.write(`\u2139 ${n} +`)}H.exitCode=r.worst}function nXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=KX(".",t,{checkStages:FA,onIndex:rc,gitOpInProgress:LO,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 iXe(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=NY(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=Rre(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(`${Ire(i)} -`),H.exit(0)}function eXe(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=I4(Ia(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] +`),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=Cre(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(`${Dre(i)} +`),H.exit(0)}function oXe(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=I4(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(` `).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${I4(l,160)} `);c.length>4&&H.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` @@ -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(` ${I4(r,160)} `);e.length>5&&H.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` -`)}}function I4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function tXe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(u0(e,"."),null,2)} -`),H.exitCode=0;return}H.stdout.write(`${Pre(e,".",{internal:t.internal})} -`),H.exit(0)}function rXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function nXe(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=u0(i,e),s={gitHead:xa(e),version:fn(),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=KG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{MYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${rXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function iXe(t){let e=rT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function oXe(){let t=new G4;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(LYe),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(zYe),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(UYe),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(BYe),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(GYe),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(YYe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(qYe),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(XYe),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(HYe),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(tXe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(VYe),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)=>WYe(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=>A7(r,{checkStages:MA})),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=>KYe(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=>JYe(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=>Yte(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>Xte()),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=>{Qte(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=>NG(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=>gX(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=>nXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(iXe),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(v7),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(FYe),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){qX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}CX(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(Dte),t}var sXe=!!globalThis.__CLADDING_BUNDLED,aXe=sXe||import.meta.url===`file://${H.argv[1]}`;aXe&&oXe().parse();export{ZYe as TIER_STAGES,oXe as createProgram,nXe as runBundleCommand,YYe as runCheckCommand,MA as runCheckStages,qYe as runCheckpointCommand,VYe as runContextCommand,XYe as runDoneCommand,WYe as runImpactCommand,KYe as runInferDepsCommand,LYe as runInitCommand,JYe as runMeasureCommand,QYe as runOracleCommand,HYe as runRollbackCommand,iXe as runRouteCommand,zYe as runRunCommand,FYe as runServeCommand,BYe as runSetupCommand,tXe as runStatusCommand,UYe as runSyncCommand,GYe as runUpdateCommand}; +`)}}function I4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function sXe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(d0(e,"."),null,2)} +`),H.exitCode=0;return}H.stdout.write(`${Nre(e,".",{internal:t.internal})} +`),H.exit(0)}function aXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function cXe(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=d0(i,e),s={gitHead:xa(e),version:fn(),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=KG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{qYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${aXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function lXe(t){let e=nT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function uXe(){let t=new G4;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(BYe),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(GYe),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(ZYe),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(KYe),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(JYe),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(rXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(VYe),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(nXe),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)=>iXe(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(WYe),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(sXe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(XYe),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)=>QYe(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=>R7(r,{checkStages:FA})),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=>eXe(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=>tXe(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=>ere(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>tre()),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=>{rre(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=>NG(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=>bX(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=>cXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(lXe),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(x7),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(HYe),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){GX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}jX(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(Mte),t}var dXe=!!globalThis.__CLADDING_BUNDLED,fXe=dXe||import.meta.url===`file://${H.argv[1]}`;fXe&&uXe().parse();export{YYe as TIER_STAGES,uXe as createProgram,cXe as runBundleCommand,rXe as runCheckCommand,FA as runCheckStages,VYe as runCheckpointCommand,XYe as runContextCommand,nXe as runDoneCommand,QYe as runImpactCommand,eXe as runInferDepsCommand,BYe as runInitCommand,tXe as runMeasureCommand,iXe as runOracleCommand,WYe as runRollbackCommand,lXe as runRouteCommand,GYe as runRunCommand,HYe as runServeCommand,KYe as runSetupCommand,sXe as runStatusCommand,ZYe as runSyncCommand,JYe as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index 1765e99d..316a1b4c 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: 278 + features: 279 scenarios: 2 capabilities: 6 - test_files: 255 + test_files: 256 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 5cb84a97..a1572503 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -26,20 +26,20 @@ attested_modules: CHANGELOG.md: 78288e943090a029 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: 63e3e36ab7fcc2bd - README.ja.md: 9b92d8e95638d2aa - README.ko.html: 49e211ff1332a0fd - README.ko.md: 8866dfcceffc6c7b - README.md: 8bb065e43d439752 - README.zh.md: 2d7b5f006f7ff930 + README.html: bcfa2b3d93de7f56 + README.ja.md: 072d19e94604f165 + README.ko.html: d54456b6aa795341 + README.ko.md: 53875c680af622d3 + README.md: 87a865c94c73ebf8 + README.zh.md: 09ee2df6c5c36872 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 conformance/runner.ts: b9c9e71df85d382e docs/README.md: 5672e5726104d845 docs/ab-evaluation-extended/README.md: f690562df2e5ec06 - docs/ab-evaluation-extended/scenarios/dashboard/report.md: 9ad86472f76c2c29 - docs/ab-evaluation-extended/scenarios/task-manager/report.md: fe3c789cc9b88eb1 + docs/ab-evaluation-extended/scenarios/dashboard/report.md: a656cad8c8ac2772 + docs/ab-evaluation-extended/scenarios/task-manager/report.md: 91df11ca4e9bed26 docs/ab-evaluation-extended/summary.md: d16f16836f94bd80 docs/ab-evaluation/README.md: 2467808b9871dcf0 docs/ab-evaluation/case-doverunner-scale.md: 2a435b6855823d41 @@ -123,7 +123,7 @@ attested_modules: skills/serve/SKILL.md: f08bbdbbfeb05041 skills/status/SKILL.md: 09faadc50b3449da skills/sync/SKILL.md: 775c0f990a52a3d9 - spec.yaml: 7e4f358630fa44f2 + spec.yaml: 9937e09b6401f878 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -193,7 +193,7 @@ attested_modules: src/cli/verdict.ts: 85a4ef27292b9169 src/core/checkpoint.ts: 63300c2764533b6c src/core/git-ops.ts: c144e5cc253822b3 - src/core/language-evidence.ts: 0e1a959a10f7bb1c + src/core/language-evidence.ts: eaccacbbf14020e8 src/core/postmortem.ts: 73be29d5e8a16fd4 src/core/telemetry-summary.ts: 6782bfaa6c3ecfa6 src/drive: a4d0f0eb87fed960 @@ -269,7 +269,7 @@ attested_modules: src/stages/cov.ts: 3dbe8381e374e8c0 src/stages/deliverable-smoke.ts: 9ecfd4210e6ec5c0 src/stages/detector-result-cache.ts: 93ea6af02ef361c5 - src/stages/detectors/README.md: 12e8d24351eef05c + src/stages/detectors/README.md: 3fe2c865aa2adcba src/stages/detectors/absence-of-governance.ts: 954d8ce5c45b3b32 src/stages/detectors/ac-drift.ts: 1bceeae9ee99080b src/stages/detectors/ac-duplicate-within-feature.ts: 652ad48c8cd1ab2e @@ -310,7 +310,7 @@ attested_modules: src/stages/detectors/stale-tests.ts: caf59404d1282201 src/stages/detectors/status-drift.ts: 9cc5cf3f9b62ea00 src/stages/detectors/tech-stack-mismatch.ts: 4da504acb67aaa86 - src/stages/detectors/unmapped-artifact.ts: b29f7e277d8187ae + src/stages/detectors/unmapped-artifact.ts: 6696179e5958f37c src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 src/stages/detectors/with-spec.ts: dcf3205e8d563574 @@ -440,7 +440,7 @@ attested_modules: tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 - tests/stages/unmapped-artifact.test.ts: 6bfdae66990fd63a + tests/stages/unmapped-artifact.test.ts: c16219779f6164bb tests/stages/util.test.ts: a162cbe069c85f41 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 @@ -624,6 +624,7 @@ attested_features: F-836a90: ok F-8476ccb1: ok F-876b6f48: ok + F-87bb7ed3: ok F-898783ee: ok F-8f419e: ok F-904495a5: ok diff --git a/spec/features/self-describing-scan-universe-87bb7ed3.yaml b/spec/features/self-describing-scan-universe-87bb7ed3.yaml new file mode 100644 index 00000000..5b3ef8a9 --- /dev/null +++ b/spec/features/self-describing-scan-universe-87bb7ed3.yaml @@ -0,0 +1,72 @@ +id: F-87bb7ed3 +slug: self-describing-scan-universe +title: "Self-describing scan universe for UNMAPPED_ARTIFACT" +status: done +modules: + - src/stages/detectors/unmapped-artifact.ts + - src/core/language-evidence.ts +acceptance_criteria: + - id: AC-4d21c8a7 + ears: event + condition: "when the project has at least 8 features and declared architecture layers" + action: "derive the scan universe from evidence — extensions are the union of (observed source extensions that the vocabulary knows) and (extensions of modules claimed under layer roots), expanded to one glob per root, layer, and extension" + response: "a C++, Java, or C# project is actually scanned instead of falling through to a *.ts glob that matches nothing, which was measured to pass vacuously on exactly the projects the module-to-feature honesty check exists for" + text: "When the full scan is active, the system shall build the UNMAPPED_ARTIFACT universe from observed known extensions united with the extensions of layer-claimed modules, replacing the fixed per-language extension table." + notes: | + ## Why + EXT_BY_LANGUAGE knew 6 languages; declaring cpp, java, or csharp fell back + to 'ts', producing zero scanned files and a silent pass — verified by + direct scanPatterns calls. Two evidence sources compose: observation + covers lazy specs (unclaimed .cpp stays visible even when only .java is + claimed), and claimed modules teach unknown languages (.zig enters the + universe the moment a feature claims a .zig file) with no table growth. + test_refs: ["tests/stages/unmapped-artifact.test.ts", "tests/stages/unmapped-universe-evidence.test.ts"] + - id: AC-9a6f02d3 + ears: event + condition: "when claimed module paths place layer directories under a nested root such as src/main/kotlin" + action: "infer each scan root from the path segments before the layer segment, falling back to src when no module teaches a root" + response: "the Kotlin source-set layout keeps working without its dedicated ROOT_BY_LANGUAGE entry, and any other nested layout works the same way for free" + text: "The system shall infer scan roots from the claimed module paths' segments preceding a declared layer name, keep only roots carrying at least 25% of layer-claimed modules, and default to src when no module teaches a root." + notes: | + ## Why the dominance filter + Layer names are common words, so segment matching alone teaches collision + roots — measured on this repository: tests/ (9.6% of layer-claimed + modules), skills/, plugins/claude-code, and the empty root via + spec/features, together producing 430 false unclaimed findings and a red + strict gate. A root must carry >=25% of layer-claimed modules; src + carries 86% here and a Gradle src/main/kotlin + src/main/java split at + 50/50 keeps both roots (pinned by test). Accepted trade, recorded + honestly: a genuine minority source root under 25% is silently not + scanned — a false negative matching the old world's blindness to every + non-src root, so coverage is still a superset of the table it replaces. + The share is ratio-noisy at small claim counts: with only two + layer-claimed modules, one test-file claim makes its root a 50% peer and + its unclaimed siblings error findings. Measured and accepted — claiming a + test file under modules declares that root governed, and the cure is + claiming or unclaiming deliberately, not a special-casing table. + test_refs: ["tests/stages/unmapped-artifact.test.ts", "tests/stages/unmapped-universe-evidence.test.ts"] + - id: AC-c5e83b19 + ears: unwanted + condition: "if the project has fewer than 8 features or no declared architecture layers" + action: "keep the existing legacy narrow fallback patterns byte-identical" + response: "day-1 adoptions keep their protective narrow scan; the evidence model only governs grown projects" + text: "If the full-scan scale gate is not met, the system shall return the unchanged legacy fallback patterns." + test_refs: ["tests/stages/unmapped-artifact.test.ts"] + - id: AC-7f14d6e0 + ears: ubiquitous + action: "build the scan universe without reading spec.project.language" + response: "the detector is language-independent: no label lookup can misdirect the universe, and an unknown declared language cannot produce a vacuous scan" + text: "The system shall derive the UNMAPPED_ARTIFACT universe without consulting spec.project.language." + notes: | + ## Why + The language scalar was the single point through which every mislabel + became a wrong or empty universe. Evidence (what is on disk, what the + spec claims) cannot be mislabeled the way a string can. Measured on the + dogfood repo (277 features): the evidence universe produces zero new + unclaimed findings — the discipline is in the spec, not the label. + test_refs: ["tests/stages/unmapped-universe-evidence.test.ts"] +design_impact: + classification: none + rationale: "Rewires one detector's universe derivation from a language table to spec-and-tree evidence; scale gate, severity, and finding shape unchanged." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index b67a7afc..9a75e26a 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -182,6 +182,7 @@ features: F-836a90: {slug: link-capability-tool, status: done, modules: 2} F-8476ccb1: {slug: readme-multiagent-inversion, status: done, modules: 6} F-876b6f48: {slug: shard-term-to-spec-entry, status: done, modules: 7} + F-87bb7ed3: {slug: self-describing-scan-universe, status: done, modules: 2} F-898783ee: {slug: self-count-guard, status: done, modules: 17} F-8f419e: {slug: smoke-legacy-liveness, status: done, modules: 1} F-904495a5: {slug: changelog-render, status: done, modules: 5} diff --git a/src/core/language-evidence.ts b/src/core/language-evidence.ts index 607c329e..72f7b6f9 100644 --- a/src/core/language-evidence.ts +++ b/src/core/language-evidence.ts @@ -15,6 +15,12 @@ // says java), which is the right answer for "what command do we run" // and the wrong answer for project identity. // +// The third export answers the neighbouring question — "which source +// extensions does this tree actually contain?" — because a caller that +// builds file globs needs the extensions themselves, not the labels: +// inverting a label back through the map would glob for `.hpp`, `.cc` +// and `.cxx` on a project that only ever writes `.cpp`. +// // Deterministic + synchronous by contract (Iron Law): filesystem reads // only, no LLM, never throws. An unreadable directory is skipped, not // raised, so a permission-denied subtree can never break a gate run. @@ -105,25 +111,28 @@ export interface ClassifyOptions { readonly maxFiles?: number; } +/** Resolves the walk cap from {@link ClassifyOptions}; values below 1 are ignored. */ +function resolveCap(opts: ClassifyOptions): number { + return opts.maxFiles !== undefined && opts.maxFiles >= 1 ? opts.maxFiles : MAX_FILES; +} + /** - * Walks `cwd` and counts source files per language. + * The one bounded tree walk both public readers share, so a caller that + * asks for labels and a caller that asks for extensions can never see + * different files. * - * The walk is synchronous, iterative (no recursion depth limit), and - * bounded by {@link MAX_FILES}. Symlinked directories are not followed — + * Synchronous, iterative (no recursion depth limit), and stopped at + * `cap` files. Symlinked directories are not followed — * `Dirent.isDirectory()` is false for a symlink — so a cyclic link * cannot hang the walk. Unreadable directories are skipped silently. * - * @param cwd - Project root to classify. - * @param opts - Optional {@link ClassifyOptions}. - * @returns The observed {@link SourceEvidence}; an empty tree yields - * `classified: 0`, `dominant: null`, and `share() === 0`. + * @param cwd - Project root to walk. + * @param cap - Hard file budget for this walk. + * @param onFile - Receives each visited file's lower-cased extension + * (`''` when the name carries none). */ -export function classifySources(cwd: string, opts: ClassifyOptions = {}): SourceEvidence { - const cap = opts.maxFiles !== undefined && opts.maxFiles >= 1 ? opts.maxFiles : MAX_FILES; - const counts: Record = {}; - let classified = 0; +function walkExtensions(cwd: string, cap: number, onFile: (ext: string) => void): void { let visited = 0; - const stack: string[] = [cwd]; while (stack.length > 0 && visited < cap) { const dir = stack.pop()!; @@ -142,12 +151,34 @@ export function classifySources(cwd: string, opts: ClassifyOptions = {}): Source if (!entry.isFile()) continue; if (visited >= cap) break; visited += 1; - const language = EXT_TO_LANGUAGE[extname(entry.name).toLowerCase()]; - if (language === undefined) continue; - counts[language] = (counts[language] ?? 0) + 1; - classified += 1; + onFile(extname(entry.name).toLowerCase()); } } +} + +/** + * Walks `cwd` and counts source files per language. + * + * The walk is synchronous, iterative (no recursion depth limit), and + * bounded by {@link MAX_FILES}. Symlinked directories are not followed — + * `Dirent.isDirectory()` is false for a symlink — so a cyclic link + * cannot hang the walk. Unreadable directories are skipped silently. + * + * @param cwd - Project root to classify. + * @param opts - Optional {@link ClassifyOptions}. + * @returns The observed {@link SourceEvidence}; an empty tree yields + * `classified: 0`, `dominant: null`, and `share() === 0`. + */ +export function classifySources(cwd: string, opts: ClassifyOptions = {}): SourceEvidence { + const counts: Record = {}; + let classified = 0; + + walkExtensions(cwd, resolveCap(opts), (ext) => { + const language = EXT_TO_LANGUAGE[ext]; + if (language === undefined) return; + counts[language] = (counts[language] ?? 0) + 1; + classified += 1; + }); const set = Object.keys(counts).sort(); let dominant: string | null = null; @@ -166,3 +197,25 @@ export function classifySources(cwd: string, opts: ClassifyOptions = {}): Source }, }; } + +/** + * Walks `cwd` and reports which vocabulary-known extensions occur in it. + * + * Same bounded walk as {@link classifySources} — same cap, same skipped + * directories — but it answers with extensions rather than labels, for + * callers that build file globs. Extensions the vocabulary does not know + * are omitted: an unknown extension names no language, and a caller that + * wants one anyway has to learn it from somewhere other than a guess. + * + * @param cwd - Project root to inspect. + * @param opts - Optional {@link ClassifyOptions}. + * @returns The observed extensions, lower-cased with their leading dot + * (`.ts`), sorted; an empty or unreadable tree yields `[]`. + */ +export function observedKnownExtensions(cwd: string, opts: ClassifyOptions = {}): readonly string[] { + const found = new Set(); + walkExtensions(cwd, resolveCap(opts), (ext) => { + if (EXT_TO_LANGUAGE[ext] !== undefined) found.add(ext); + }); + return [...found].sort(); +} diff --git a/src/stages/detectors/README.md b/src/stages/detectors/README.md index aff64994..59849ba4 100644 --- a/src/stages/detectors/README.md +++ b/src/stages/detectors/README.md @@ -93,7 +93,7 @@ Each of the remaining 38 is real, but carries a condition — or stays dormant u | **config-dependent** (needs external config / binary) | `HARDCODED_SECRET` (needs `.secretlintrc` + secretlint), `COVERAGE_DROP` (needs coverage report), `PERFORMANCE_DRIFT` (needs perf baseline) | | **code-anchor-dependent** (needs a `// AC-NNN: ` comment in source — no anchor → no catch) | `AC_DRIFT` | | **warn-severity** (does not fail the gate alone) | `MISSING_TESTS`, `STALE_TESTS`, `COVERAGE_DROP`, `STALE_EVIDENCE`, `STALE_SPECIFICATION`, `TECH_STACK_MISMATCH`, `CONVENTION_DRIFT`, `PERFORMANCE_DRIFT`, `UNMAPPED_ARTIFACT` *(default; promoted to error by `--strict`)* | -| **scoped-scan** (narrow glob — drift outside the scan paths is invisible) | `UNMAPPED_ARTIFACT` scans `stages/**` and `spec/**` only | +| **scoped-scan** (bounded universe — drift outside it is invisible) | `UNMAPPED_ARTIFACT` scans declared-layer roots for evidenced extensions (observed known + layer-claimed); legacy narrow globs below the 8-feature scale gate | | **environment** (needs project structure cladding expects) | `HARNESS_INTEGRITY`, `REFERENCE_INTEGRITY`, `META_INTEGRITY` | ### Opt-in strict mode diff --git a/src/stages/detectors/unmapped-artifact.ts b/src/stages/detectors/unmapped-artifact.ts index bcc59a30..3e2d9413 100644 --- a/src/stages/detectors/unmapped-artifact.ts +++ b/src/stages/detectors/unmapped-artifact.ts @@ -5,12 +5,39 @@ // MISSING_IMPLEMENTATION: it scans real source files and flags any // that no feature in spec.yaml claims via `features[].modules`. // +// The scan universe is EVIDENCE, never a language label (F-87bb7ed3). +// Two sources compose, each covering the other's blind spot: +// +// 1. Observation — every vocabulary-known extension that actually +// occurs in the tree (core/language-evidence). This covers the +// lazy spec: an unclaimed `.cpp` file stays visible even when the +// spec claims only `.java` ones, which is the exact case this +// detector exists for. +// 2. Claimed modules — the extension and the root of every module a +// feature claims under a declared layer. This teaches languages +// the vocabulary has never heard of: a claimed `.zig` file enters +// the universe with no table to grow, and a claimed +// `src/main/kotlin/core/A.kt` teaches the root `src/main/kotlin` +// that used to need a per-language table entry. +// +// `EXT_BY_LANGUAGE` and `ROOT_BY_LANGUAGE` are gone, and with them every +// read of `spec.project.language`. Those tables knew six languages, so a +// project declaring `cpp`, `java`, or `csharp` fell through to a `*.ts` +// glob that matched nothing — a silent pass on precisely the projects +// the module→feature honesty check is for. A label can be wrong; what +// is on disk and what the spec claims cannot be mislabelled the same way. +// // Pure spec ↔ filesystem comparison, no OSS for the *logic* — though // glob scanning is delegated to `tinyglobby` because Node's stdlib // doesn't ship a globber. +// +// @see spec/features/self-describing-scan-universe-87bb7ed3.yaml + +import {extname} from 'node:path'; import {globSync} from 'tinyglobby'; +import {observedKnownExtensions} from '../../core/language-evidence.js'; import type {Spec} from '../../spec/types.js'; import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; import {normalizeArchitecture} from './architecture-from-spec.js'; @@ -25,36 +52,92 @@ const NAME = 'UNMAPPED_ARTIFACT'; */ const LEGACY_SCAN_PATTERNS: readonly string[] = ['src/stages/**/*.ts', 'src/spec/**/*.ts']; -const EXT_BY_LANGUAGE: Record = { - typescript: 'ts', - javascript: 'js', - python: 'py', - rust: 'rs', - go: 'go', - kotlin: 'kt', -}; +const MIN_FEATURES_FOR_FULL_SCAN = 8; // same scale-gate idiom as HOLLOW_GOVERNANCE et al. + +/** Where layer directories live when no claimed module teaches a root. */ +const DEFAULT_ROOT = 'src'; /** - * Layer-scan root per language. Defaults to `src` (where the other - * languages keep their layer dirs); Kotlin nests its layers under the - * Gradle/Maven `src/main/kotlin` source set. + * Share of layer-claimed modules a root must carry to become a scan root. + * + * Root inference reads a path segment, so any directory that happens to + * reuse a layer name teaches a root: `tests/spec/parse.test.ts` teaches + * `tests`, `skills/init/SKILL.md` teaches `skills`. Those are name + * collisions, not source roots, and admitting them turns every mirrored + * test tree into hundreds of "unclaimed" findings — the false-RED class + * the scale gate below exists to prevent. A real second source root + * carries a substantial share of the claims (a Gradle project split + * across `src/main/kotlin` and `src/main/java` is near 50/50); an + * incidental collision carries a thin tail. Measured on the dogfood repo + * (279 features, 811 layer-claimed modules): unfiltered inference yields + * 430 findings, all from collisions; at this threshold `src` alone + * survives with 86% of the claims and the finding count is 0. */ -const ROOT_BY_LANGUAGE: Record = { - kotlin: 'src/main/kotlin', -}; +const MIN_ROOT_SHARE = 0.25; + +/** What the spec's own module claims teach about the scan universe. */ +interface ClaimedEvidence { + /** Path prefixes that precede a declared layer name, dominance-filtered. */ + readonly roots: readonly string[]; + /** Extensions claimed under one of those roots, with leading dot. */ + readonly extensions: readonly string[]; +} /** - * F-aee61f — the scan universe derives from the DECLARED architecture: one - * `src//**` pattern per layer (both string-tier and {name} object - * forms), extension from project.language. Before this, two hardcoded - * directories left the module→feature honesty check blind to 13 of - * cladding's own 15 src/ directories — a confidently wrong map is worse - * than none. No architecture declared → legacy narrow fallback. - * Exported for tests. + * Reads roots and extensions out of `features[].modules`. + * + * Only a module that sits under a declared layer teaches anything: a + * root-level `CHANGELOG.md` claim contributes neither a root nor an + * extension, so documentation claims cannot widen the source universe. */ -const MIN_FEATURES_FOR_FULL_SCAN = 8; // same scale-gate idiom as HOLLOW_GOVERNANCE et al. +function claimedEvidence(spec: Spec, layers: ReadonlySet): ClaimedEvidence { + const claimsByRoot = new Map(); + const extensionsByRoot = new Map>(); + let total = 0; -export function scanPatterns(spec: Spec): readonly string[] { + for (const feature of spec.features ?? []) { + for (const modulePath of feature.modules ?? []) { + const segments = modulePath.split('/'); + // The last segment is the file itself — a file named like a layer + // is not a directory the layer lives in. + const layerAt = segments.findIndex( + (segment, i) => i < segments.length - 1 && layers.has(segment), + ); + if (layerAt < 0) continue; + + const root = segments.slice(0, layerAt).join('/'); + claimsByRoot.set(root, (claimsByRoot.get(root) ?? 0) + 1); + total += 1; + + const ext = extname(segments[segments.length - 1]); + if (ext === '') continue; // a claimed directory teaches its root, not an extension + const known = extensionsByRoot.get(root) ?? new Set(); + known.add(ext); + extensionsByRoot.set(root, known); + } + } + + const roots: string[] = []; + const extensions = new Set(); + for (const [root, claims] of claimsByRoot) { + if (claims / total < MIN_ROOT_SHARE) continue; + roots.push(root); + for (const ext of extensionsByRoot.get(root) ?? []) extensions.add(ext); + } + return {roots, extensions: [...extensions]}; +} + +/** + * Builds the glob set the detector scans: one pattern per scan root, + * declared layer, and evidenced extension. + * + * @param spec - The loaded spec; read for features, architecture, and + * module claims — never for `project.language`. + * @param cwd - Project root, walked once for the observed extensions. + * @returns Sorted, deduplicated glob patterns; the legacy narrow pair + * when the full-scan scale gate is not met. + */ +export function scanPatterns(spec: Spec, cwd: string): readonly string[] { // Scale-gated (F-aee61f): a fresh adoption legitimately has scan-derived // architecture layers but features accumulating on demand — instantly // flagging every not-yet-claimed file would wall off day-1 adoption (the @@ -63,10 +146,20 @@ export function scanPatterns(spec: Spec): readonly string[] { if ((spec.features ?? []).length < MIN_FEATURES_FOR_FULL_SCAN) return LEGACY_SCAN_PATTERNS; const {layers} = normalizeArchitecture(spec.architecture ?? {}); if (layers.size === 0) return LEGACY_SCAN_PATTERNS; - const language = spec.project?.language ?? ''; - const ext = EXT_BY_LANGUAGE[language] ?? 'ts'; - const root = ROOT_BY_LANGUAGE[language] ?? 'src'; - return [...layers].sort().map((l) => `${root}/${l}/**/*.${ext}`); + + const claimed = claimedEvidence(spec, layers); + const roots = claimed.roots.length > 0 ? claimed.roots : [DEFAULT_ROOT]; + const extensions = new Set([...observedKnownExtensions(cwd), ...claimed.extensions]); + + const patterns = new Set(); + for (const root of roots) { + // An empty root means the layers sit at the repository root itself. + const prefix = root === '' ? '' : `${root}/`; + for (const layer of layers) { + for (const ext of extensions) patterns.add(`${prefix}${layer}/**/*${ext}`); + } + } + return [...patterns].sort(); } /** @@ -75,8 +168,8 @@ export function scanPatterns(spec: Spec): readonly string[] { * Returns one `error` finding per unclaimed file. When spec.yaml is * absent or unparseable, returns a single `info` finding (opt-in: * spec-less projects keep green CI). The detector intentionally does - * not walk the entire repo — only the directories cladding's own - * tsconfig declares as source. + * not walk the entire repo — only the roots and layers the spec and the + * tree together evidence as source. * * @see iron-law.md stage_1.3 — detector contract. * @see ironclad-design/08-drift-detectors.md — UNMAPPED_ARTIFACT (#1). @@ -92,7 +185,11 @@ function detect(spec: Spec, cwd: string): readonly DriftFinding[] { for (const modulePath of feature.modules ?? []) claimed.add(modulePath); } - const files = globSync([...scanPatterns(spec)], {cwd, dot: false}); + const patterns = scanPatterns(spec, cwd); + // No evidenced extension means no source universe. Guarded rather than + // handed to the globber, so "nothing to scan" can never be read as + // "scan everything". + const files = patterns.length === 0 ? [] : globSync([...patterns], {cwd, dot: false}); const findings: DriftFinding[] = []; for (const file of files) { if (claimed.has(file)) continue; diff --git a/tests/core/language-evidence.test.ts b/tests/core/language-evidence.test.ts index e690b3d1..5b710fad 100644 --- a/tests/core/language-evidence.test.ts +++ b/tests/core/language-evidence.test.ts @@ -16,7 +16,11 @@ // yields classified 0 / dominant null / share 0 rather than a throw; // - the walk is capped, so a detector invoking it on every gate run // stays bounded (asserted through the exported cap + the injectable -// `maxFiles` override — 20 000 real files are never created). +// `maxFiles` override — 20 000 real files are never created); +// - `observedKnownExtensions` reports the extensions actually present +// rather than every extension the matching label could have — the +// glob-building contract UNMAPPED_ARTIFACT depends on (AC-4d21c8a7 +// of F-87bb7ed3). import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; @@ -28,6 +32,7 @@ import { EXT_TO_LANGUAGE, LANGUAGE_VOCABULARY, MAX_FILES, + observedKnownExtensions, } from '../../src/core/language-evidence.js'; import {EXT_TO_LANGUAGE as SCAN_EXT_TO_LANGUAGE} from '../../src/cli/scan/thresholds.js'; @@ -140,3 +145,44 @@ describe('core/language-evidence — classifySources', () => { expect(classifySources(dir).classified).toBe(12); }); }); + +describe('core/language-evidence — observedKnownExtensions', () => { + let dir: string; + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-langext-')); + }); + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('AC-4d21c8a7 — reports the extensions present, not every extension the label covers', () => { + seed(dir, join('src', 'engine'), '.cpp', 3); + seed(dir, join('src', 'engine'), '.h', 1); + seed(dir, 'scripts', '.py', 2); + + // `.cc`, `.cxx` and `.hpp` share the cpp label but are absent from the + // tree — globbing for them would scan directories that cannot match. + expect(observedKnownExtensions(dir)).toEqual(['.cpp', '.h', '.py']); + }); + + test('AC-4d21c8a7 — unknown extensions, vendored trees and dot directories are left out', () => { + seed(dir, 'src', '.ts', 2); + seed(dir, 'docs', '.md', 4); + seed(dir, join('node_modules', 'pkg'), '.js', 5); + seed(dir, join('.venv', 'lib'), '.py', 5); + + expect(observedKnownExtensions(dir)).toEqual(['.ts']); + }); + + test('AC-4d21c8a7 — an empty or missing tree yields no extensions, and the walk is capped', () => { + expect(observedKnownExtensions(dir)).toEqual([]); + expect(observedKnownExtensions(join(dir, 'nope'))).toEqual([]); + + seed(dir, 'a', '.ts', 6); + seed(dir, 'b', '.py', 6); + // Injected cap: the walk stops early, so it can miss a language — the + // same bounded contract classifySources runs under. + expect(observedKnownExtensions(dir, {maxFiles: 1}).length).toBe(1); + expect(observedKnownExtensions(dir)).toEqual(['.py', '.ts']); + }); +}); diff --git a/tests/stages/unmapped-artifact.test.ts b/tests/stages/unmapped-artifact.test.ts index c9cbbfd2..719d5173 100644 --- a/tests/stages/unmapped-artifact.test.ts +++ b/tests/stages/unmapped-artifact.test.ts @@ -1,13 +1,19 @@ // Cladding · unit tests for stages/detectors/unmapped-artifact.ts // -// Detector under test scans `stages/**/*.ts` and `spec/**/*.ts` from the -// cwd, comparing every file against the set of paths declared in -// `features[].modules`. An unclaimed file emits an `error` finding. +// The detector compares real source files against the set of paths +// declared in `features[].modules`; an unclaimed file emits an `error` +// finding. Which files count as "real source" is the scan universe, and +// since F-87bb7ed3 that universe is built from evidence — what the tree +// contains plus what the spec claims — never from `project.language`. // // What's notable about this detector and how we test it: -// - Scope is **narrow on purpose** (tsconfig.include mirror) so test -// fixtures, tooling configs, and generated files do not appear as -// findings. Tests need to confirm that narrow scoping holds. +// - Below the scale gate the universe is the **narrow legacy pair**, on +// purpose, so day-1 adoptions are not walled off by findings for +// files they have not claimed yet. +// - Above it, scope is **evidenced**: observed extensions keep a lazy +// spec honest, claimed modules teach roots and unknown languages. +// Only modules under a declared layer teach, so a root-level docs +// claim cannot widen the source universe. // - It is status-blind: an archived feature still claims its modules, // because deleting the archived feature's source is a separate // workflow that STATUS_DRIFT / STALE_SPECIFICATION owns. @@ -16,7 +22,7 @@ import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; -import {join} from 'node:path'; +import {dirname, join} from 'node:path'; import {afterEach, beforeEach, describe, expect, test} from 'vitest'; import {scanPatterns, unmappedArtifact} from '../../src/stages/detectors/unmapped-artifact.js'; @@ -26,6 +32,13 @@ const SPEC_HEADER = 'project: {name: x, language: typescript}\n' + 'features: []\n'; +/** Writes `rel` under `dir`, creating parent directories. */ +function write(dir: string, rel: string, body = 'x\n'): void { + const full = join(dir, rel); + mkdirSync(dirname(full), {recursive: true}); + writeFileSync(full, body); +} + describe('UNMAPPED_ARTIFACT detector', () => { let dir: string; beforeEach(() => { @@ -110,80 +123,261 @@ describe('UNMAPPED_ARTIFACT detector', () => { }); }); -// ─── F-aee61f — scan roots derive from declared architecture layers ─── +// ─── scan universe: declared layers (F-aee61f) × evidence (F-87bb7ed3) ─── const EIGHT_FEATURES = Array.from({length: 8}, (_, i) => ({ id: `F-00000${i}`, title: 't', status: 'done', - modules: [], + modules: [] as string[], acceptance_criteria: [], })); -describe('scanPatterns (F-aee61f)', () => { +/** The eight features of the full-scan scale gate, the first one claiming `modules`. */ +function claiming(...modules: string[]): unknown[] { + return EIGHT_FEATURES.map((f, i) => (i === 0 ? {...f, modules} : f)); +} + +describe('scanPatterns', () => { + let dir: string; + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-unmapped-universe-')); + }); + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + test('scale gate: under 8 features the legacy narrow patterns apply even with layers declared', () => { + write(dir, 'src/cli/a.ts'); const spec = { project: {name: 'x', language: 'typescript'}, features: EIGHT_FEATURES.slice(0, 3), architecture: {layers: [['cli']]}, } as never; - expect(scanPatterns(spec)).toEqual(['src/stages/**/*.ts', 'src/spec/**/*.ts']); + expect(scanPatterns(spec, dir)).toEqual(['src/stages/**/*.ts', 'src/spec/**/*.ts']); }); - test('derives one src/ pattern per declared layer (canonical string-tier form), language-aware', () => { + test('falls back to the legacy narrow patterns when no architecture is declared', () => { + const spec = {project: {name: 'x', language: 'typescript'}, features: []} as never; + expect(scanPatterns(spec, dir)).toEqual(['src/stages/**/*.ts', 'src/spec/**/*.ts']); + }); + + test('derives one pattern per declared layer (canonical string-tier form) from the observed extension', () => { + write(dir, 'src/cli/a.ts'); const spec = { project: {name: 'x', language: 'typescript'}, features: EIGHT_FEATURES, architecture: {layers: [['cli', 'serve'], ['core']]}, } as never; - expect(scanPatterns(spec)).toEqual(['src/cli/**/*.ts', 'src/core/**/*.ts', 'src/serve/**/*.ts']); + expect(scanPatterns(spec, dir)).toEqual([ + 'src/cli/**/*.ts', + 'src/core/**/*.ts', + 'src/serve/**/*.ts', + ]); }); - test('accepts the {name} object layer form and non-TS languages', () => { + test('accepts the {name} object layer form', () => { + write(dir, 'src/api/handler.py'); const spec = { project: {name: 'x', language: 'python'}, features: EIGHT_FEATURES, architecture: {layers: [{name: 'api'}, {name: 'domain'}]}, } as never; - expect(scanPatterns(spec)).toEqual(['src/api/**/*.py', 'src/domain/**/*.py']); + expect(scanPatterns(spec, dir)).toEqual(['src/api/**/*.py', 'src/domain/**/*.py']); }); - test('falls back to the legacy narrow patterns when no architecture is declared', () => { - const spec = {project: {name: 'x', language: 'typescript'}, features: []} as never; - expect(scanPatterns(spec)).toEqual(['src/stages/**/*.ts', 'src/spec/**/*.ts']); + test('AC-4d21c8a7 — every observed extension enters the universe, not just one per language', () => { + // The measured defect: `cpp` had no table entry, so the universe was + // `*.ts` and matched nothing. Both C++ extensions must now be scanned. + write(dir, 'src/engine/vm.cpp'); + write(dir, 'src/engine/vm.h'); + const spec = { + project: {name: 'x', language: 'cpp'}, + features: EIGHT_FEATURES, + architecture: {layers: [['engine']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/engine/**/*.cpp', 'src/engine/**/*.h']); }); - test('a file in a declared layer that no feature claims is now FOUND (was blind pre-0.6)', () => { - const dir = mkdtempSync(join(tmpdir(), 'clad-unmapped-arch-')); - try { - mkdirSync(join(dir, 'src', 'router'), {recursive: true}); - writeFileSync(join(dir, 'src', 'router', 'orphan.ts'), 'export const x = 1;\n'); - writeFileSync( - join(dir, 'spec.yaml'), - [ - 'schema: "0.1"', - 'project: {name: f, language: typescript}', - 'architecture:', - ' layers:', - ' - [router]', - 'features:', - ...Array.from({length: 8}, (_, i) => - [ - ` - id: F-10000${i}`, - ' title: t', - ' status: done', - ' modules: []', - ' acceptance_criteria:', - ' - {id: AC-001, ears: ubiquitous, text: t, test_refs: [spec.yaml]}', - ].join('\n'), - ), - ].join('\n') + '\n', + test('AC-4d21c8a7 — observation keeps a lazy spec honest: an unclaimed language stays in scope', () => { + write(dir, 'src/engine/vm.cpp'); // nothing claims this one + write(dir, 'src/engine/Bridge.java'); + const spec = { + project: {name: 'x', language: 'java'}, + features: claiming('src/engine/Bridge.java'), + architecture: {layers: [['engine']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/engine/**/*.cpp', 'src/engine/**/*.java']); + }); + + test('AC-4d21c8a7 — a claimed module teaches an extension the vocabulary has never heard of', () => { + write(dir, 'src/core/vm.zig'); // unknown to the vocabulary → observation ignores it + const spec = { + project: {name: 'x', language: 'zig'}, + features: claiming('src/core/vm.zig'), + architecture: {layers: [['core']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/core/**/*.zig']); + }); + + test('AC-9a6f02d3 — the scan root is inferred from the segments before the layer', () => { + write(dir, 'src/main/kotlin/core/A.kt'); + const spec = { + project: {name: 'x', language: 'kotlin'}, + features: claiming('src/main/kotlin/core/A.kt'), + architecture: {layers: [['core']]}, + } as never; + // Used to require a ROOT_BY_LANGUAGE entry; now the claim teaches it. + expect(scanPatterns(spec, dir)).toEqual(['src/main/kotlin/core/**/*.kt']); + }); + + test('AC-9a6f02d3 — two substantial source roots both survive (Gradle kotlin + java split)', () => { + const spec = { + project: {name: 'x', language: 'kotlin'}, + features: claiming('src/main/kotlin/core/A.kt', 'src/main/java/core/B.java'), + architecture: {layers: [['core']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual([ + 'src/main/java/core/**/*.java', + 'src/main/java/core/**/*.kt', + 'src/main/kotlin/core/**/*.java', + 'src/main/kotlin/core/**/*.kt', + ]); + }); + + test('AC-9a6f02d3 — src is the fallback root when no module teaches one', () => { + write(dir, 'src/core/a.ts'); + const spec = { + project: {name: 'x', language: 'typescript'}, + features: claiming('README.md'), // claimed, but under no declared layer + architecture: {layers: [['core']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/core/**/*.ts']); + }); + + test('a directory that merely reuses a layer name does not become a scan root', () => { + // `tests/core/...` teaches the root `tests` by segment match alone. Left + // unfiltered, a mirrored test tree turns every unclaimed test file into a + // finding — so a root has to carry a real share of the claims. + write(dir, 'src/core/a.ts'); + write(dir, 'tests/core/a.test.ts'); + const spec = { + project: {name: 'x', language: 'typescript'}, + features: claiming( + 'src/core/a.ts', + 'src/core/b.ts', + 'src/core/c.ts', + 'src/core/d.ts', + 'src/core/e.ts', + 'src/core/f.ts', + 'src/core/g.ts', + 'src/core/h.ts', + 'src/core/i.ts', + 'tests/core/a.test.ts', + ), + architecture: {layers: [['core']]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/core/**/*.ts']); + }); + + test('claims outside every declared layer teach neither a root nor an extension', () => { + write(dir, 'src/core/a.ts'); + const base = { + project: {name: 'x', language: 'typescript'}, + features: claiming('src/core/a.ts'), + architecture: {layers: [['core']]}, + }; + const withDocs = { + ...base, + features: claiming('src/core/a.ts', 'CHANGELOG.md', 'docs/guide.md'), + }; + expect(scanPatterns(withDocs as never, dir)).toEqual(scanPatterns(base as never, dir)); + expect(scanPatterns(withDocs as never, dir)).toEqual(['src/core/**/*.ts']); + }); + + test('AC-7f14d6e0 — the universe is identical whatever project.language says', () => { + write(dir, 'src/core/vm.cpp'); + write(dir, 'src/core/vm.h'); + const universe = (language: unknown): readonly string[] => + scanPatterns( + { + project: language === undefined ? {name: 'x'} : {name: 'x', language}, + features: EIGHT_FEATURES, + architecture: {layers: [['core']]}, + } as never, + dir, ); - const findings = unmappedArtifact.run({cwd: dir}); - const hit = findings.find((f) => f.path === 'src/router/orphan.ts'); - expect(hit?.severity).toBe('error'); - } finally { - rmSync(dir, {recursive: true, force: true}); - } + const expected = ['src/core/**/*.cpp', 'src/core/**/*.h']; + expect(universe('cpp')).toEqual(expected); + expect(universe('typescript')).toEqual(expected); // a wrong label cannot misdirect it + expect(universe('brainfuck')).toEqual(expected); // nor an unknown one + expect(universe(undefined)).toEqual(expected); // nor a missing one + }); +}); + +// ─── end-to-end: the universe reaches real findings ─── + +/** An inline spec with `count` features, the given layers, and an optional claim. */ +function inlineSpec(language: string, layers: string[], modules: string[] = []): string { + return ( + [ + 'schema: "0.1"', + `project: {name: f, language: ${language}}`, + 'architecture:', + ' layers:', + ` - [${layers.join(', ')}]`, + 'features:', + ...Array.from({length: 8}, (_, i) => + [ + ` - id: F-10000${i}`, + ' title: t', + ' status: done', + ` modules: [${i === 0 ? modules.join(', ') : ''}]`, + ' acceptance_criteria:', + ' - {id: AC-001, ears: ubiquitous, text: t, test_refs: [spec.yaml]}', + ].join('\n'), + ), + ].join('\n') + '\n' + ); +} + +describe('UNMAPPED_ARTIFACT — declared layers reach real files', () => { + let dir: string; + beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'clad-unmapped-arch-')); + }); + afterEach(() => { + rmSync(dir, {recursive: true, force: true}); + }); + + test('a file in a declared layer that no feature claims is FOUND (was blind pre-0.6)', () => { + write(dir, 'src/router/orphan.ts', 'export const x = 1;\n'); + writeFileSync(join(dir, 'spec.yaml'), inlineSpec('typescript', ['router'])); + const findings = unmappedArtifact.run({cwd: dir}); + const hit = findings.find((f) => f.path === 'src/router/orphan.ts'); + expect(hit?.severity).toBe('error'); + }); + + test('AC-4d21c8a7 — a C++ project is scanned instead of passing vacuously', () => { + // Pre-F-87bb7ed3 this project globbed `src/router/**/*.ts`, matched + // nothing, and reported a clean bill of health. + write(dir, 'src/router/orphan.cpp', 'int main() { return 0; }\n'); + write(dir, 'src/router/claimed.cpp', 'int claimed() { return 1; }\n'); + writeFileSync(join(dir, 'spec.yaml'), inlineSpec('cpp', ['router'], ['src/router/claimed.cpp'])); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.map((f) => f.path)).toEqual(['src/router/orphan.cpp']); + expect(findings[0].severity).toBe('error'); + expect(findings[0].message).toContain('not claimed by any feature'); + }); + + test('AC-9a6f02d3 — a nested source root inferred from a claim reaches its unclaimed neighbour', () => { + write(dir, 'src/main/kotlin/core/Claimed.kt', 'fun claimed() {}\n'); + write(dir, 'src/main/kotlin/core/Orphan.kt', 'fun orphan() {}\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec('kotlin', ['core'], ['src/main/kotlin/core/Claimed.kt']), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.map((f) => f.path)).toEqual(['src/main/kotlin/core/Orphan.kt']); }); }); diff --git a/tests/stages/unmapped-universe-evidence.test.ts b/tests/stages/unmapped-universe-evidence.test.ts new file mode 100644 index 00000000..a54701d8 --- /dev/null +++ b/tests/stages/unmapped-universe-evidence.test.ts @@ -0,0 +1,258 @@ +// Cladding · impl-blind oracle for F-87bb7ed3 — authored from the spec contract only. +// +// Contract under test (given, not read from source): +// import {unmappedArtifact} from '../../src/stages/detectors/unmapped-artifact.js'; +// const findings = unmappedArtifact.run({cwd}); +// finding: {detector: 'UNMAPPED_ARTIFACT', severity: 'error', message: string, path?: string} +// one finding per source file in the scan universe not claimed by any features[].modules +// +// Evidence-derived universe (active only when features.length >= 8 AND architecture +// layers are declared — the legacy narrow scan is out of scope here): +// · extensions = (known-language extensions OBSERVED anywhere in the tree) +// ∪ (extensions of modules CLAIMED under a root/layer path) +// · unknown-to-vocabulary extensions (.zig …) enter ONLY by being claimed +// · scan roots are inferred from claimed module paths: the segments BEFORE the +// layer segment (src/main/kotlin/core/A.kt + layer 'core' → root src/main/kotlin); +// with no teaching module the root is 'src' +// · files scanned: //**/*; a file claimed by ANY feature is never +// reported; spec.project.language has NO effect on the universe +// +// Fixture notes (scaffolding only — no expectation is derived from the implementation): +// · feature ids must satisfy the spec schema's ^F-(\d{3,}|[a-f0-9]{6,})$, so the +// padding features use hash-shaped ids rather than the brief's shorthand F-1. +// · architecture.layers is written as the brief renders it: each entry is a sequence +// of layer names (a tier), so layers [core, app] is `- - core` / ` - app`. +// · a .ts control tree was used to confirm these fixtures actually reach the scan, so +// a zero-finding result below is a behavioural gap, not a dead fixture. +// +// Severity note: the declared severity ('error') is asserted in its own dedicated case +// rather than inside the shared shape helper, so a single deviation there cannot mask +// the eight universe verdicts. It is asserted, unweakened. + +import {afterAll, describe, expect, it} from 'vitest'; +import {mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {dirname, join} from 'node:path'; + +import {unmappedArtifact} from '../../src/stages/detectors/unmapped-artifact.js'; + +type Finding = { + detector: string; + severity: string; + message: string; + path?: string; +}; + +type Fixture = { + /** spec.project.language — declared, and per contract inert for the universe. */ + language: string; + /** architecture.layers — one layer name per entry. */ + layers: string[]; + /** modules[] per feature; padded to nine features with empty-module entries. */ + claims: string[][]; + /** source files to materialise, repo-relative. */ + files: string[]; +}; + +const scratch: string[] = []; + +afterAll(() => { + for (const dir of scratch) rmSync(dir, {recursive: true, force: true}); +}); + +/** architecture.layers block: one tier holding every layer name. */ +function layerBlock(names: string[]): string[] { + return names.map((name, index) => (index === 0 ? ` - - ${name}` : ` - ${name}`)); +} + +function makeFixture(fixture: Fixture): string { + const dir = mkdtempSync(join(tmpdir(), 'clad-unmapped-universe-')); + scratch.push(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + + const featureCount = Math.max(9, fixture.claims.length); + const featureBlocks: string[] = []; + for (let i = 0; i < featureCount; i++) { + const modules = fixture.claims[i] ?? []; + const id = `F-a${String(i + 1).padStart(7, '0')}`; + const lines = [` - id: ${id}`, ' title: t', ' status: done']; + if (modules.length === 0) { + lines.push(' modules: []'); + } else { + lines.push(' modules:'); + for (const module of modules) lines.push(` - "${module}"`); + } + featureBlocks.push(lines.join('\n')); + } + + const yaml = [ + 'schema: "0.1"', + 'project:', + ' name: x', + ` language: ${fixture.language}`, + 'architecture:', + ' layers:', + ...layerBlock(fixture.layers), + 'features:', + ...featureBlocks, + '', + ].join('\n'); + writeFileSync(join(dir, 'spec.yaml'), yaml, 'utf8'); + + for (const rel of fixture.files) { + const abs = join(dir, rel); + mkdirSync(dirname(abs), {recursive: true}); + writeFileSync(abs, '// x\n', 'utf8'); + } + + return dir; +} + +/** Runs the detector and enforces the declared finding identity on every finding. */ +function scan(fixture: Fixture): Finding[] { + const findings = unmappedArtifact.run({cwd: makeFixture(fixture)}) as Finding[]; + expect(Array.isArray(findings)).toBe(true); + for (const finding of findings) { + expect(finding.detector).toBe('UNMAPPED_ARTIFACT'); + expect(typeof finding.message).toBe('string'); + expect(finding.message.length).toBeGreaterThan(0); + } + return findings; +} + +/** Sorted, separator-normalised path set of the findings. */ +function reported(findings: Finding[]): string[] { + return findings + .map(finding => (finding.path ?? '').replace(/\\/g, '/').replace(/^\.\//, '')) + .sort(); +} + +/** The findings' own messages, echoed as failure context. */ +function said(findings: Finding[]): string { + if (findings.length === 0) return 'detector reported no findings'; + return findings.map(finding => `[${finding.severity}] ${finding.message}`).join(' || '); +} + +function expectExactly(findings: Finding[], expected: string[]): void { + expect(reported(findings), said(findings)).toEqual([...expected].sort()); +} + +const CASE_1_TREE = { + layers: ['core'], + claims: [['src/core/rasp.cpp']], + files: ['src/core/rasp.cpp', 'src/core/extra.cpp', 'src/core/util.h'], +} as const; + +function caseOneFixture(language: string): Fixture { + return { + language, + layers: [...CASE_1_TREE.layers], + claims: CASE_1_TREE.claims.map(modules => [...modules]), + files: [...CASE_1_TREE.files], + }; +} + +describe('UNMAPPED_ARTIFACT · evidence-derived scan universe (F-87bb7ed3)', () => { + it('reports native sources the spec never claims (cpp tree, was vacuous)', () => { + const findings = scan(caseOneFixture('cpp')); + + expectExactly(findings, ['src/core/extra.cpp', 'src/core/util.h']); + expect(reported(findings)).toEqual( + expect.arrayContaining(['src/core/extra.cpp', 'src/core/util.h']), + ); + expect(reported(findings)).not.toContain('src/core/rasp.cpp'); + }); + + it('still sees native sources when every claimed module is another language', () => { + const findings = scan({ + language: 'cpp', + layers: ['core', 'app'], + claims: [['src/core/Main.java', 'src/app/App.java']], + files: [ + 'src/core/Main.java', + 'src/app/App.java', + 'src/core/a.cpp', + 'src/core/b.cpp', + ], + }); + + // .cpp is a known-language extension observed in the tree, so it is in the + // universe even though no module ever claims a .cpp file. + expectExactly(findings, ['src/core/a.cpp', 'src/core/b.cpp']); + }); + + it('lets a claimed module teach an extension unknown to the vocabulary', () => { + const findings = scan({ + language: 'zig', + layers: ['core'], + claims: [['src/core/a.zig']], + files: ['src/core/a.zig', 'src/core/b.zig'], + }); + + expectExactly(findings, ['src/core/b.zig']); + }); + + it('keeps an untaught unknown extension out of the universe', () => { + const findings = scan({ + language: 'zig', + layers: ['core'], + claims: [['src/core/a.ts']], + files: ['src/core/a.ts', 'src/core/b.zig', 'src/core/c.ts'], + }); + + // .zig is neither observed-known nor claimed → invisible; .ts enters as both. + expectExactly(findings, ['src/core/c.ts']); + expect(reported(findings)).not.toContain('src/core/b.zig'); + }); + + it('infers the scan root from the claimed module path (kotlin layout)', () => { + const findings = scan({ + language: 'kotlin', + layers: ['core'], + claims: [['src/main/kotlin/core/A.kt']], + files: ['src/main/kotlin/core/A.kt', 'src/main/kotlin/core/B.kt'], + }); + + expectExactly(findings, ['src/main/kotlin/core/B.kt']); + }); + + it('derives the universe from evidence, not from the declared language label', () => { + const asCpp = scan(caseOneFixture('cpp')); + const asJava = scan(caseOneFixture('java')); + + expectExactly(asJava, ['src/core/extra.cpp', 'src/core/util.h']); + expect(reported(asJava), said(asJava)).toEqual(reported(asCpp)); + }); + + it('reports nothing once every scanned file is claimed by some feature', () => { + const findings = scan({ + language: 'cpp', + layers: [...CASE_1_TREE.layers], + claims: [['src/core/rasp.cpp'], ['src/core/extra.cpp'], ['src/core/util.h']], + files: [...CASE_1_TREE.files], + }); + + expectExactly(findings, []); + expect(findings, said(findings)).toHaveLength(0); + }); + + it('unions every observed known extension into one scan universe', () => { + const findings = scan({ + language: 'cpp', + layers: ['core'], + claims: [['src/core/a.cpp']], + files: ['src/core/a.cpp', 'src/core/b.h', 'src/core/c.ts'], + }); + + expectExactly(findings, ['src/core/b.h', 'src/core/c.ts']); + }); + + it('raises each unmapped artifact at the declared severity', () => { + const findings = scan(caseOneFixture('cpp')); + + expect(findings.length, said(findings)).toBeGreaterThan(0); + for (const finding of findings) { + expect(finding.severity, said(findings)).toBe('error'); + } + }); +}); From c41ba2ef99a60d3c4d07b1ff2a799832d575efc5 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 15:16:58 +0900 Subject: [PATCH 3/6] feat(init,doctor): make the gate config survive a fresh clone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clad init ignored .cladding/ with the directory form, and git never re-includes under an excluded directory — so .cladding/config.yaml (gate.scope, gate.commands, gate.coverage, gate.test_report) could not be committed at all. Every documented gate override was local-only: fresh clones and CI silently ran a different gate than the author tuned, and --strict exists for CI. Found by a live host run during the gate.language E2E, verified with git check-ignore. Fresh projects now get the contents-exclusion pair (.cladding/* plus !.cladding/config.yaml) rendered by a pure policy module. An existing .gitignore carrying any recognized cladding entry — the legacy directory form included — stays byte-identical; instead of rewriting adopters' files, clad doctor reports a blocked gate config in text and JSON, the same read-only posture as the unpinned-CI report. The dogfood repo's own .gitignore moves to the pair form, and the onboarding description no longer promises the directory form. Verified: 23-test impl-blind oracle (contract-only, includes live git check-ignore ground truth) passing on first contact with the implementation, end-to-end harness through the built CLI (fresh init committable, legacy adopter byte-identical + doctor blocked, new-form quiet), full suite 2936/2936. F-b0c2e724 · clad done under a GREEN strict pre-push gate — the gate itself first refused this commit because the new policy module was claimed by no feature: F-87bb7ed3's evidence universe caught its own sibling's spec gap. Co-Authored-By: Claude Opus 5 --- .gitignore | 5 +- 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 | 791 +++++++++--------- spec.yaml | 4 +- spec/attestation.yaml | 26 +- .../gate-config-committable-b0c2e724.yaml | 49 ++ spec/index.yaml | 1 + src/cli/doctor.ts | 30 +- src/cli/init.ts | 36 +- src/init/gitignore-policy.ts | 125 +++ src/serve/server.ts | 2 +- tests/cli/doctor.test.ts | 52 +- tests/cli/gitignore-gate-config.test.ts | 186 ++++ tests/cli/init.test.ts | 40 +- 19 files changed, 925 insertions(+), 446 deletions(-) create mode 100644 spec/features/gate-config-committable-b0c2e724.yaml create mode 100644 src/init/gitignore-policy.ts create mode 100644 tests/cli/gitignore-gate-config.test.ts diff --git a/.gitignore b/.gitignore index 20a1f519..6dca7bfd 100644 --- a/.gitignore +++ b/.gitignore @@ -60,8 +60,9 @@ test-results/ playwright-report/ *.snap.png -# Cladding runtime state — audit log, events log, etc. -.cladding/ +# Cladding runtime state — audit log, events log, etc. (config.yaml stays committable) +.cladding/* +!.cladding/config.yaml # A/B-extended generated React demo projects. # These are regeneratable on demand via `UPDATE_AB_REPORTS=1 npx vitest run` diff --git a/README.html b/README.html index ce72e4f7..4ec015c9 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

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

Status

tests
-
2909/2909
+
2936/2936
all pass
diff --git a/README.ja.md b/README.ja.md index 379da19f..3564caec 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) | 2909 / 2909 | 15 段階 · 41 detectors | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2936 / 2936 | 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 eb1c56d7..e192ab95 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
-
2909/2909
+
2936/2936
all pass
diff --git a/README.ko.md b/README.ko.md index a78a0892..68a9480d 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) | 2909 / 2909 · 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) | 2936 / 2936 · 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 7e15e265..9d567b45 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) | 2909 / 2909 | 15 stages · 41 detectors | 277 (273 done) | +| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2936 / 2936 | 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 782f3150..107bdfea 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) | 2909 / 2909 | 15 阶段 · 41 检测器 | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2936 / 2936 | 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 2b8e429d..44c83243 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,51 +4,51 @@ 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 Tfe=Object.create;var LA=Object.defineProperty;var Ofe=Object.getOwnPropertyDescriptor;var Rfe=Object.getOwnPropertyNames;var Ife=Object.getPrototypeOf,Pfe=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)LA(t,r,{get:e[r],enumerable:!0})},Cfe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Rfe(e))!Pfe.call(t,i)&&i!==r&&LA(t,i,{get:()=>e[i],enumerable:!(n=Ofe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?Tfe(Ife(t)):{},Cfe(e||!t||!t.__esModule?LA(r,"default",{value:t,enumerable:!0}):r,t));var df=v(UA=>{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}},zA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};UA.CommanderError=Ty;UA.InvalidArgumentError=zA});var Oy=v(HA=>{var{InvalidArgumentError:Dfe}=df(),qA=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 Dfe(`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 Nfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}HA.Argument=qA;HA.humanReadableArgName=Nfe});var ZA=v(GA=>{var{humanReadableArgName:jfe}=Oy(),BA=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=>jfe(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 P4(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 utypeof 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)LA(t,r,{get:e[r],enumerable:!0})},Ufe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ffe(e))!zfe.call(t,i)&&i!==r&&LA(t,i,{get:()=>e[i],enumerable:!(n=Mfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?jfe(Lfe(t)):{},Ufe(e||!t||!t.__esModule?LA(r,"default",{value:t,enumerable:!0}):r,t));var ff=v(UA=>{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}},zA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};UA.CommanderError=Ty;UA.InvalidArgumentError=zA});var Oy=v(HA=>{var{InvalidArgumentError:qfe}=ff(),qA=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 qfe(`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 Hfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}HA.Argument=qA;HA.humanReadableArgName=Hfe});var ZA=v(GA=>{var{humanReadableArgName:Bfe}=Oy(),BA=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=>Bfe(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 C4(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 P4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}GA.Help=BA;GA.stripColor=P4});var JA=v(KA=>{var{InvalidArgumentError:Mfe}=df(),VA=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=Ffe(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 Mfe(`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?C4(this.name().replace(/^no-/,"")):C4(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}},WA=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 C4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Ffe(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 C4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}GA.Help=BA;GA.stripColor=C4});var JA=v(KA=>{var{InvalidArgumentError:Gfe}=ff(),VA=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=Zfe(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 Gfe(`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?D4(this.name().replace(/^no-/,"")):D4(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}},WA=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 D4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Zfe(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} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}KA.Option=VA;KA.DualOptions=WA});var N4=v(D4=>{function Lfe(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 zfe(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=Lfe(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?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}KA.Option=VA;KA.DualOptions=WA});var j4=v(N4=>{function Vfe(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 Wfe(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=Vfe(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]}?)`:""}D4.suggestSimilar=zfe});var L4=v(tT=>{var Ufe=Ge("node:events").EventEmitter,YA=Ge("node:child_process"),mo=Ge("node:path"),Ry=Ge("node:fs"),He=Ge("node:process"),{Argument:qfe,humanReadableArgName:Hfe}=Oy(),{CommanderError:XA}=df(),{Help:Bfe,stripColor:Gfe}=ZA(),{Option:j4,DualOptions:Zfe}=JA(),{suggestSimilar:M4}=N4(),QA=class t extends Ufe{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:()=>eT()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>eT()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Gfe(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 Bfe,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 qfe(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 XA(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 j4(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 j4)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. +(Did you mean ${n[0]}?)`:""}N4.suggestSimilar=Wfe});var z4=v(tT=>{var Kfe=Ze("node:events").EventEmitter,YA=Ze("node:child_process"),mo=Ze("node:path"),Ry=Ze("node:fs"),He=Ze("node:process"),{Argument:Jfe,humanReadableArgName:Yfe}=Oy(),{CommanderError:XA}=ff(),{Help:Xfe,stripColor:Qfe}=ZA(),{Option:M4,DualOptions:epe}=JA(),{suggestSimilar:F4}=j4(),QA=class t extends Kfe{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:()=>eT()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>eT()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Qfe(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 Xfe,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 XA(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 M4(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 M4)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(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(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=F4(He.execArgv).concat(r),c=YA.spawn(He.argv[0],r,{stdio:"inherit"})):c=YA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=F4(He.execArgv).concat(r),c=YA.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 XA(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 XA(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=L4(He.execArgv).concat(r),c=YA.spawn(He.argv[0],r,{stdio:"inherit"})):c=YA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=L4(He.execArgv).concat(r),c=YA.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 XA(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 XA(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=M4(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=M4(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=>Hfe(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. +`),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 epe(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=F4(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=F4(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=>Yfe(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 F4(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 eT(){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}tT.Command=QA;tT.useColor=eT});var H4=v(On=>{var{Argument:z4}=Oy(),{Command:rT}=L4(),{CommanderError:Vfe,InvalidArgumentError:U4}=df(),{Help:Wfe}=ZA(),{Option:q4}=JA();On.program=new rT;On.createCommand=t=>new rT(t);On.createOption=(t,e)=>new q4(t,e);On.createArgument=(t,e)=>new z4(t,e);On.Command=rT;On.Option=q4;On.Argument=z4;On.Help=Wfe;On.CommanderError=Vfe;On.InvalidArgumentError=U4;On.InvalidOptionArgumentError=U4});var De=v(er=>{"use strict";var iT=Symbol.for("yaml.alias"),V4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),W4=Symbol.for("yaml.pair"),oT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),epe=t=>!!t&&typeof t=="object"&&t[ho]===iT,tpe=t=>!!t&&typeof t=="object"&&t[ho]===V4,rpe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,npe=t=>!!t&&typeof t=="object"&&t[ho]===W4,K4=t=>!!t&&typeof t=="object"&&t[ho]===oT,ipe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function J4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ope(t){if(t&&typeof t=="object")switch(t[ho]){case iT:case Iy:case oT:case Py:return!0}return!1}var spe=t=>(K4(t)||J4(t))&&!!t.anchor;er.ALIAS=iT;er.DOC=V4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=W4;er.SCALAR=oT;er.SEQ=Py;er.hasAnchor=spe;er.isAlias=epe;er.isCollection=J4;er.isDocument=tpe;er.isMap=rpe;er.isNode=ope;er.isPair=npe;er.isScalar=K4;er.isSeq=ipe});var ff=v(sT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),Y4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=X4(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=Y4;Cy.REMOVE=Ti;function nl(t,e,r,n){let i=Q4(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return eH(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 tH=De(),ape=ff(),cpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},lpe=t=>t.replace(/[!,[\]{}]/g,e=>cpe[e]),pf=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+lpe(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&&tH.isNode(e.contents)){let o={};ape.visit(e.contents,(s,a)=>{tH.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(` -`)}};pf.defaultYaml={explicit:!1,version:"1.2"};pf.defaultTags={"!!":"tag:yaml.org,2002:"};rH.Directives=pf});var Ny=v(mf=>{"use strict";var nH=De(),upe=ff();function dpe(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 iH(t){let e=new Set;return upe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function oH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function fpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=iH(t));let s=oH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(nH.isScalar(s.node)||nH.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}}mf.anchorIsValid=dpe;mf.anchorNames=iH;mf.createNodeAnchors=fpe;mf.findNewAnchor=oH});var cT=v(sH=>{"use strict";function hf(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,o=n.length;i{"use strict";var ppe=De();function aH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>aH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!ppe.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}cH.toJS=aH});var jy=v(uH=>{"use strict";var mpe=cT(),lH=De(),hpe=Wo(),lT=class{constructor(e){Object.defineProperty(this,lH.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(!lH.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=hpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?mpe.applyReviver(o,{"":a},"",a):a}};uH.NodeBase=lT});var gf=v(dH=>{"use strict";var gpe=Ny(),ype=ff(),ol=De(),_pe=jy(),bpe=Wo(),uT=class extends _pe.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=[],ype.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||(bpe.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(gpe.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}dH.Alias=uT});var Dt=v(dT=>{"use strict";var vpe=De(),Spe=jy(),wpe=Wo(),xpe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Spe.NodeBase{constructor(e){super(vpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:wpe.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";dT.Scalar=Ko;dT.isScalarValue=xpe});var yf=v(pH=>{"use strict";var $pe=gf(),ha=De(),fH=Dt(),kpe="tag:yaml.org,2002:";function Epe(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 Ape(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=kpe+e.slice(2));let l=Epe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new fH.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 fH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}pH.createNode=Ape});var Ly=v(Fy=>{"use strict";var Tpe=yf(),Oi=De(),Ope=jy();function fT(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 Tpe.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 mH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pT=class extends Ope.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(mH(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,fT(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,fT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=pT;Fy.collectionFromPath=fT;Fy.isEmptyPath=mH});var _f=v(zy=>{"use strict";var Rpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Ipe=(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 L4(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 eT(){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}tT.Command=QA;tT.useColor=eT});var B4=v(On=>{var{Argument:U4}=Oy(),{Command:rT}=z4(),{CommanderError:tpe,InvalidArgumentError:q4}=ff(),{Help:rpe}=ZA(),{Option:H4}=JA();On.program=new rT;On.createCommand=t=>new rT(t);On.createOption=(t,e)=>new H4(t,e);On.createArgument=(t,e)=>new U4(t,e);On.Command=rT;On.Option=H4;On.Argument=U4;On.Help=rpe;On.CommanderError=tpe;On.InvalidArgumentError=q4;On.InvalidOptionArgumentError=q4});var De=v(er=>{"use strict";var iT=Symbol.for("yaml.alias"),W4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),K4=Symbol.for("yaml.pair"),oT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),cpe=t=>!!t&&typeof t=="object"&&t[ho]===iT,lpe=t=>!!t&&typeof t=="object"&&t[ho]===W4,upe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,dpe=t=>!!t&&typeof t=="object"&&t[ho]===K4,J4=t=>!!t&&typeof t=="object"&&t[ho]===oT,fpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function Y4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ppe(t){if(t&&typeof t=="object")switch(t[ho]){case iT:case Iy:case oT:case Py:return!0}return!1}var mpe=t=>(J4(t)||Y4(t))&&!!t.anchor;er.ALIAS=iT;er.DOC=W4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=K4;er.SCALAR=oT;er.SEQ=Py;er.hasAnchor=mpe;er.isAlias=cpe;er.isCollection=Y4;er.isDocument=lpe;er.isMap=upe;er.isNode=ppe;er.isPair=dpe;er.isScalar=J4;er.isSeq=fpe});var pf=v(sT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),X4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=Q4(e);Ut.isDocument(t)?il(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):il(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=X4;Cy.REMOVE=Ti;function il(t,e,r,n){let i=eH(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return tH(t,n,i),il(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 rH=De(),hpe=pf(),gpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ype=t=>t.replace(/[!,[\]{}]/g,e=>gpe[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+ype(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&&rH.isNode(e.contents)){let o={};hpe.visit(e.contents,(s,a)=>{rH.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:"};nH.Directives=mf});var Ny=v(hf=>{"use strict";var iH=De(),_pe=pf();function bpe(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 oH(t){let e=new Set;return _pe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function sH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function vpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=oH(t));let s=sH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(iH.isScalar(s.node)||iH.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=bpe;hf.anchorNames=oH;hf.createNodeAnchors=vpe;hf.findNewAnchor=sH});var cT=v(aH=>{"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 Spe=De();function cH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>cH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Spe.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}lH.toJS=cH});var jy=v(dH=>{"use strict";var wpe=cT(),uH=De(),xpe=Wo(),lT=class{constructor(e){Object.defineProperty(this,uH.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(!uH.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=xpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?wpe.applyReviver(o,{"":a},"",a):a}};dH.NodeBase=lT});var yf=v(fH=>{"use strict";var $pe=Ny(),kpe=pf(),sl=De(),Epe=jy(),Ape=Wo(),uT=class extends Epe.NodeBase{constructor(e){super(sl.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=[],kpe.visit(e,{Node:(o,s)=>{(sl.isAlias(s)||sl.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||(Ape.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($pe.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(sl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(sl.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(sl.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}fH.Alias=uT});var Dt=v(dT=>{"use strict";var Tpe=De(),Ope=jy(),Rpe=Wo(),Ipe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Ope.NodeBase{constructor(e){super(Tpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Rpe.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";dT.Scalar=Ko;dT.isScalarValue=Ipe});var _f=v(mH=>{"use strict";var Ppe=yf(),ha=De(),pH=Dt(),Cpe="tag:yaml.org,2002:";function Dpe(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 Npe(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 Ppe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Cpe+e.slice(2));let l=Dpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new pH.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 pH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}mH.createNode=Npe});var Ly=v(Fy=>{"use strict";var jpe=_f(),Oi=De(),Mpe=jy();function fT(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 jpe.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 hH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pT=class extends Mpe.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(hH(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,fT(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,fT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=pT;Fy.collectionFromPath=fT;Fy.isEmptyPath=hH});var bf=v(zy=>{"use strict";var Fpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Lpe=(t,e,r)=>t.endsWith(` `)?mT(r,e):r.includes(` `)?` -`+mT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=mT;zy.lineComment=Ipe;zy.stringifyComment=Rpe});var gH=v(bf=>{"use strict";var Ppe="flow",hT="block",Uy="quoted";function Cpe(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===hT&&(h=hH(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===hT&&(h=hH(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+mT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=mT;zy.lineComment=Lpe;zy.stringifyComment=Fpe});var yH=v(vf=>{"use strict";var zpe="flow",hT="block",Uy="quoted";function Upe(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===hT&&(h=gH(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===hT&&(h=gH(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===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=gH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function Dpe(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 vf(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{"use strict";var Xn=Dt(),Jo=yH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function qpe(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(` @@ -57,47 +57,47 @@ ${r}`)+"'";return e.implicitKey?n:Jo.foldFlowLines(n,r,Jo.FOLD_FLOW,Hy(e,!1))}fu `)b=g;else break}let _=r.substring(0,b{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 Npe(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 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 jpe(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 vf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return gT(s.value,e);case Xn.Scalar.PLAIN:return Npe(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}yH.stringifyString=jpe});var wf=v(_T=>{"use strict";var Mpe=Ny(),Yo=De(),Fpe=_f(),Lpe=Sf();function zpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Fpe.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 Upe(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 qpe(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],o=(Yo.isScalar(t)||Yo.isCollection(t))&&t.anchor;o&&Mpe.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 Hpe(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=Upe(e.doc.schema.tags,o));let s=qpe(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)?Lpe.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}_T.createStringifyContext=zpe;_T.stringify=Hpe});var SH=v(vH=>{"use strict";var go=De(),_H=Dt(),bH=wf(),xf=_f();function Bpe({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===_H.Scalar.BLOCK_FOLDED||t.type===_H.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=bH.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+=xf.lineComment(g,r.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=xf.lineComment(g,r.indent,l(f))),g=`? ${g} -${a}:`):(g=`${g}:`,f&&(g+=xf.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=bH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` +${l}${_}${r}${p}`}function Hpe(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 al(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` +`)?al(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 al(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 al(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,Hy(e,!1))}function Bpe(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?al(s.value,e):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return Sf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return gT(s.value,e);case Xn.Scalar.PLAIN:return Hpe(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}_H.stringifyString=Bpe});var xf=v(_T=>{"use strict";var Gpe=Ny(),Yo=De(),Zpe=bf(),Vpe=wf();function Wpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Zpe.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 Kpe(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&&Gpe.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 Ype(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=Kpe(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)?Vpe.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}_T.createStringifyContext=Wpe;_T.stringify=Ype});var wH=v(SH=>{"use strict";var go=De(),bH=Dt(),vH=xf(),$f=bf();function Xpe({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===bH.Scalar.BLOCK_FOLDED||t.type===bH.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=vH.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=vH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` `:"",_){let A=l(_);R+=` -${xf.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 wH=Ge("process");function Gpe(t,...e){t==="debug"&&console.log(...e)}function Zpe(t,e){(t==="debug"||t==="warn")&&(typeof wH.emitWarning=="function"?wH.emitWarning(e):console.warn(e))}bT.debug=Gpe;bT.warn=Zpe});var Ky=v(Wy=>{"use strict";var Vy=De(),xH=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 xH.Scalar(Symbol(Gy)),{addToJSMap:$H}),stringify:()=>Gy},Vpe=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===xH.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function $H(t,e,r){let n=kH(t,r);if(Vy.isSeq(n))for(let i of n.items)ST(t,e,i);else if(Array.isArray(n))for(let i of n)ST(t,e,i);else ST(t,e,n)}function ST(t,e,r){let n=kH(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 kH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=$H;Wy.isMergeKey=Vpe;Wy.merge=Zy});var xT=v(TH=>{"use strict";var Wpe=vT(),EH=Ky(),Kpe=wf(),AH=De(),wT=Wo();function Jpe(t,e,{key:r,value:n}){if(AH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(EH.isMergeKey(t,r))EH.addMergeToJSMap(t,e,n);else{let i=wT.toJS(r,"",t);if(e instanceof Map)e.set(i,wT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=Ype(r,i,t),s=wT.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 Ype(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(AH.isNode(t)&&r?.doc){let n=Kpe.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)+'..."'),Wpe.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)}TH.addPairToJSMap=Jpe});var Xo=v($T=>{"use strict";var OH=yf(),Xpe=SH(),Qpe=xT(),Jy=De();function eme(t,e,r){let n=OH.createNode(t,void 0,r),i=OH.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 Qpe.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?Xpe.stringifyPair(this,e,r,n):JSON.stringify(this)}};$T.Pair=Yy;$T.createPair=eme});var kT=v(IH=>{"use strict";var ga=De(),RH=wf(),Xy=_f();function tme(t,e,r){return(e.inFlow??t.flow?nme:rme)(t,e,r)}function rme({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;m{"use strict";var xH=Ze("process");function Qpe(t,...e){t==="debug"&&console.log(...e)}function eme(t,e){(t==="debug"||t==="warn")&&(typeof xH.emitWarning=="function"?xH.emitWarning(e):console.warn(e))}bT.debug=Qpe;bT.warn=eme});var Ky=v(Wy=>{"use strict";var Vy=De(),$H=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 $H.Scalar(Symbol(Gy)),{addToJSMap:kH}),stringify:()=>Gy},tme=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===$H.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function kH(t,e,r){let n=EH(t,r);if(Vy.isSeq(n))for(let i of n.items)ST(t,e,i);else if(Array.isArray(n))for(let i of n)ST(t,e,i);else ST(t,e,n)}function ST(t,e,r){let n=EH(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 EH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=kH;Wy.isMergeKey=tme;Wy.merge=Zy});var xT=v(OH=>{"use strict";var rme=vT(),AH=Ky(),nme=xf(),TH=De(),wT=Wo();function ime(t,e,{key:r,value:n}){if(TH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(AH.isMergeKey(t,r))AH.addMergeToJSMap(t,e,n);else{let i=wT.toJS(r,"",t);if(e instanceof Map)e.set(i,wT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ome(r,i,t),s=wT.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 ome(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(TH.isNode(t)&&r?.doc){let n=nme.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)+'..."'),rme.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)}OH.addPairToJSMap=ime});var Xo=v($T=>{"use strict";var RH=_f(),sme=wH(),ame=xT(),Jy=De();function cme(t,e,r){let n=RH.createNode(t,void 0,r),i=RH.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 ame.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?sme.stringifyPair(this,e,r,n):JSON.stringify(this)}};$T.Pair=Yy;$T.createPair=cme});var kT=v(PH=>{"use strict";var ga=De(),IH=xf(),Xy=bf();function lme(t,e,r){return(e.inFlow??t.flow?dme:ume)(t,e,r)}function ume({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(` +`+Xy.indentComment(l(t),c),a&&a()):d&&s&&s(),p}function dme({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 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())}}IH.stringifyCollection=tme});var es=v(AT=>{"use strict";var ime=kT(),ome=xT(),sme=Ly(),Qo=De(),e_=Xo(),ame=Dt();function $f(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 ET=class extends sme.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=$f(this.items,n.key),o=this.schema?.sortMapEntries;if(i){if(!r)throw new Error(`Key ${n.key} already set`);Qo.isScalar(i.value)&&ame.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=$f(this.items,e);return r?this.items.splice(this.items.indexOf(r),1).length>0:!1}get(e,r){let i=$f(this.items,e)?.value;return(!r&&Qo.isScalar(i)?i.value:i)??void 0}has(e){return!!$f(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)ome.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})),ime.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AT.YAMLMap=ET;AT.findPair=$f});var al=v(CH=>{"use strict";var cme=De(),PH=es(),lme={collection:"map",default:!0,nodeClass:PH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return cme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>PH.YAMLMap.from(t,e,r)};CH.map=lme});var ts=v(DH=>{"use strict";var ume=yf(),dme=kT(),fme=Ly(),r_=De(),pme=Dt(),mme=Wo(),TT=class extends fme.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}DH.YAMLSeq=TT});var cl=v(jH=>{"use strict";var hme=De(),NH=ts(),gme={collection:"seq",default:!0,nodeClass:NH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return hme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>NH.YAMLSeq.from(t,e,r)};jH.seq=gme});var kf=v(MH=>{"use strict";var yme=Sf(),_me={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),yme.stringifyString(t,e,r,n)}};MH.string=_me});var n_=v(zH=>{"use strict";var FH=Dt(),LH={identify:t=>t==null,createNode:()=>new FH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new FH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&LH.test.test(t)?t:e.options.nullStr};zH.nullTag=LH});var OT=v(qH=>{"use strict";var bme=Dt(),UH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new bme.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&UH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};qH.boolTag=UH});var ll=v(HH=>{"use strict";function vme({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}HH.stringifyNumber=vme});var IT=v(i_=>{"use strict";var Sme=Dt(),RT=ll(),wme={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:RT.stringifyNumber},xme={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():RT.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 Sme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:RT.stringifyNumber};i_.float=$me;i_.floatExp=xme;i_.floatNaN=wme});var CT=v(s_=>{"use strict";var BH=ll(),o_=t=>typeof t=="bigint"||Number.isInteger(t),PT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function GH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):BH.stringifyNumber(t)}var kme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>PT(t,2,8,r),stringify:t=>GH(t,8,"0o")},Eme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>PT(t,0,10,r),stringify:BH.stringifyNumber},Ame={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)=>PT(t,2,16,r),stringify:t=>GH(t,16,"0x")};s_.int=Eme;s_.intHex=Ame;s_.intOct=kme});var VH=v(ZH=>{"use strict";var Tme=al(),Ome=n_(),Rme=cl(),Ime=kf(),Pme=OT(),DT=IT(),NT=CT(),Cme=[Tme.map,Rme.seq,Ime.string,Ome.nullTag,Pme.boolTag,NT.intOct,NT.int,NT.intHex,DT.floatNaN,DT.floatExp,DT.float];ZH.schema=Cme});var JH=v(KH=>{"use strict";var Dme=Dt(),Nme=al(),jme=cl();function WH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Mme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new Dme.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:WH,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})=>WH(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_}],Fme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Lme=[Nme.map,jme.seq].concat(Mme,Fme);KH.schema=Lme});var MT=v(YH=>{"use strict";var Ef=Ge("buffer"),jT=Dt(),zme=Sf(),Ume={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof Ef.Buffer=="function")return Ef.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(),FT=Xo(),qme=Dt(),Hme=ts();function XH(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 FT.Pair(new qme.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())}}PH.stringifyCollection=lme});var es=v(AT=>{"use strict";var fme=kT(),pme=xT(),mme=Ly(),Qo=De(),e_=Xo(),hme=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 ET=class extends mme.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)&&hme.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)pme.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})),fme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AT.YAMLMap=ET;AT.findPair=kf});var cl=v(DH=>{"use strict";var gme=De(),CH=es(),yme={collection:"map",default:!0,nodeClass:CH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return gme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>CH.YAMLMap.from(t,e,r)};DH.map=yme});var ts=v(NH=>{"use strict";var _me=_f(),bme=kT(),vme=Ly(),r_=De(),Sme=Dt(),wme=Wo(),TT=class extends vme.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}NH.YAMLSeq=TT});var ll=v(MH=>{"use strict";var xme=De(),jH=ts(),$me={collection:"seq",default:!0,nodeClass:jH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return xme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>jH.YAMLSeq.from(t,e,r)};MH.seq=$me});var Ef=v(FH=>{"use strict";var kme=wf(),Eme={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),kme.stringifyString(t,e,r,n)}};FH.string=Eme});var n_=v(UH=>{"use strict";var LH=Dt(),zH={identify:t=>t==null,createNode:()=>new LH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new LH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&zH.test.test(t)?t:e.options.nullStr};UH.nullTag=zH});var OT=v(HH=>{"use strict";var Ame=Dt(),qH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ame.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&qH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};HH.boolTag=qH});var ul=v(BH=>{"use strict";function Tme({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}BH.stringifyNumber=Tme});var IT=v(i_=>{"use strict";var Ome=Dt(),RT=ul(),Rme={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:RT.stringifyNumber},Ime={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():RT.stringifyNumber(t)}},Pme={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 Ome.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:RT.stringifyNumber};i_.float=Pme;i_.floatExp=Ime;i_.floatNaN=Rme});var CT=v(s_=>{"use strict";var GH=ul(),o_=t=>typeof t=="bigint"||Number.isInteger(t),PT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function ZH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):GH.stringifyNumber(t)}var Cme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>PT(t,2,8,r),stringify:t=>ZH(t,8,"0o")},Dme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>PT(t,0,10,r),stringify:GH.stringifyNumber},Nme={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)=>PT(t,2,16,r),stringify:t=>ZH(t,16,"0x")};s_.int=Dme;s_.intHex=Nme;s_.intOct=Cme});var WH=v(VH=>{"use strict";var jme=cl(),Mme=n_(),Fme=ll(),Lme=Ef(),zme=OT(),DT=IT(),NT=CT(),Ume=[jme.map,Fme.seq,Lme.string,Mme.nullTag,zme.boolTag,NT.intOct,NT.int,NT.intHex,DT.floatNaN,DT.floatExp,DT.float];VH.schema=Ume});var YH=v(JH=>{"use strict";var qme=Dt(),Hme=cl(),Bme=ll();function KH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Gme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new qme.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:KH,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})=>KH(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_}],Zme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vme=[Hme.map,Bme.seq].concat(Gme,Zme);JH.schema=Vme});var MT=v(XH=>{"use strict";var Af=Ze("buffer"),jT=Dt(),Wme=wf(),Kme={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(),FT=Xo(),Jme=Dt(),Yme=ts();function QH(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 FT.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]=c_.isPair(n)?n:new FT.Pair(n)}}else e("Expected a sequence for this tag");return t}function QH(t,e,r){let{replacer:n}=r,i=new Hme.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(FT.createPair(a,c,r))}return i}var Bme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:XH,createNode:QH};l_.createPairs=QH;l_.pairs=Bme;l_.resolvePairs=XH});var UT=v(zT=>{"use strict";var e6=De(),LT=Wo(),Af=es(),Gme=ts(),t6=u_(),ya=class t extends Gme.YAMLSeq{constructor(){super(),this.add=Af.YAMLMap.prototype.add.bind(this),this.delete=Af.YAMLMap.prototype.delete.bind(this),this.get=Af.YAMLMap.prototype.get.bind(this),this.has=Af.YAMLMap.prototype.has.bind(this),this.set=Af.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(e6.isPair(i)?(o=LT.toJS(i.key,"",r),s=LT.toJS(i.value,o,r)):o=LT.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=t6.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=t6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)e6.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)};zT.YAMLOMap=ya;zT.omap=Zme});var s6=v(qT=>{"use strict";var r6=Dt();function n6({value:t,source:e},r){return e&&(t?i6:o6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var i6={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 r6.Scalar(!0),stringify:n6},o6={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 r6.Scalar(!1),stringify:n6};qT.falseTag=o6;qT.trueTag=i6});var a6=v(d_=>{"use strict";var Vme=Dt(),HT=ll(),Wme={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:HT.stringifyNumber},Kme={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():HT.stringifyNumber(t)}},Jme={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 Vme.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:HT.stringifyNumber};d_.float=Jme;d_.floatExp=Kme;d_.floatNaN=Wme});var l6=v(Of=>{"use strict";var c6=ll(),Tf=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 BT(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return c6.stringifyNumber(t)}var Yme={identify:Tf,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=>BT(t,2,"0b")},Xme={identify:Tf,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=>BT(t,8,"0")},Qme={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:c6.stringifyNumber},ehe={identify:Tf,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=>BT(t,16,"0x")};Of.int=Qme;Of.intBin=Yme;Of.intHex=ehe;Of.intOct=Xme});var ZT=v(GT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var the={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(h_.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}};GT.YAMLSet=_a;GT.set=the});var WT=v(g_=>{"use strict";var rhe=ll();function VT(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 u6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return rhe.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 nhe={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})=>VT(t,r),stringify:u6},ihe={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=>VT(t,!1),stringify:u6},d6={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(d6.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=VT(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=ihe;g_.intTime=nhe;g_.timestamp=d6});var m6=v(p6=>{"use strict";var ohe=al(),she=n_(),ahe=cl(),che=kf(),lhe=MT(),f6=s6(),KT=a6(),y_=l6(),uhe=Ky(),dhe=UT(),fhe=u_(),phe=ZT(),JT=WT(),mhe=[ohe.map,ahe.seq,che.string,she.nullTag,f6.trueTag,f6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,KT.floatNaN,KT.floatExp,KT.float,lhe.binary,uhe.merge,dhe.omap,fhe.pairs,phe.set,JT.intTime,JT.floatTime,JT.timestamp];p6.schema=mhe});var $6=v(QT=>{"use strict";var _6=al(),hhe=n_(),b6=cl(),ghe=kf(),yhe=OT(),YT=IT(),XT=CT(),_he=VH(),bhe=JH(),v6=MT(),Rf=Ky(),S6=UT(),w6=u_(),h6=m6(),x6=ZT(),__=WT(),g6=new Map([["core",_he.schema],["failsafe",[_6.map,b6.seq,ghe.string]],["json",bhe.schema],["yaml11",h6.schema],["yaml-1.1",h6.schema]]),y6={binary:v6.binary,bool:yhe.boolTag,float:YT.float,floatExp:YT.floatExp,floatNaN:YT.floatNaN,floatTime:__.floatTime,int:XT.int,intHex:XT.intHex,intOct:XT.intOct,intTime:__.intTime,map:_6.map,merge:Rf.merge,null:hhe.nullTag,omap:S6.omap,pairs:w6.pairs,seq:b6.seq,set:x6.set,timestamp:__.timestamp},vhe={"tag:yaml.org,2002:binary":v6.binary,"tag:yaml.org,2002:merge":Rf.merge,"tag:yaml.org,2002:omap":S6.omap,"tag:yaml.org,2002:pairs":w6.pairs,"tag:yaml.org,2002:set":x6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function She(t,e,r){let n=g6.get(e);if(n&&!t)return r&&!n.includes(Rf.merge)?n.concat(Rf.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let o=Array.from(g6.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(Rf.merge)),i.reduce((o,s)=>{let a=typeof s=="string"?y6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(y6).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},[])}QT.coreKnownTags=vhe;QT.getTags=She});var rO=v(k6=>{"use strict";var eO=De(),whe=al(),xhe=cl(),$he=kf(),b_=$6(),khe=(t,e)=>t.keye.key?1:0,tO=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,eO.MAP,{value:whe.map}),Object.defineProperty(this,eO.SCALAR,{value:$he.string}),Object.defineProperty(this,eO.SEQ,{value:xhe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?khe:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};k6.Schema=tO});var A6=v(E6=>{"use strict";var Ehe=De(),nO=wf(),If=_f();function Ahe(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=nO.createStringifyContext(t,e),{commentString:o}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=o(t.commentBefore);r.unshift(If.indentComment(c,""))}let s=!1,a=null;if(t.contents){if(Ehe.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=o(t.contents.commentBefore);r.push(If.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>s=!0,l=nO.stringify(t.contents,i,()=>a=null,c);a&&(l+=If.lineComment(l,"",o(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(nO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` -`)?(r.push("..."),r.push(If.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(If.indentComment(o(c),"")))}return r.join(` +${o.comment}`:n.comment}n=i}t.items[r]=c_.isPair(n)?n:new FT.Pair(n)}}else e("Expected a sequence for this tag");return t}function e6(t,e,r){let{replacer:n}=r,i=new Yme.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(FT.createPair(a,c,r))}return i}var Xme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QH,createNode:e6};l_.createPairs=e6;l_.pairs=Xme;l_.resolvePairs=QH});var UT=v(zT=>{"use strict";var t6=De(),LT=Wo(),Tf=es(),Qme=ts(),r6=u_(),ya=class t extends Qme.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(t6.isPair(i)?(o=LT.toJS(i.key,"",r),s=LT.toJS(i.value,o,r)):o=LT.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=r6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var ehe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=r6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)t6.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)};zT.YAMLOMap=ya;zT.omap=ehe});var a6=v(qT=>{"use strict";var n6=Dt();function i6({value:t,source:e},r){return e&&(t?o6:s6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var o6={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 n6.Scalar(!0),stringify:i6},s6={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 n6.Scalar(!1),stringify:i6};qT.falseTag=s6;qT.trueTag=o6});var c6=v(d_=>{"use strict";var the=Dt(),HT=ul(),rhe={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:HT.stringifyNumber},nhe={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():HT.stringifyNumber(t)}},ihe={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 the.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:HT.stringifyNumber};d_.float=ihe;d_.floatExp=nhe;d_.floatNaN=rhe});var u6=v(Rf=>{"use strict";var l6=ul(),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 BT(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 l6.stringifyNumber(t)}var ohe={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=>BT(t,2,"0b")},she={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=>BT(t,8,"0")},ahe={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:l6.stringifyNumber},che={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=>BT(t,16,"0x")};Rf.int=ahe;Rf.intBin=ohe;Rf.intHex=che;Rf.intOct=she});var ZT=v(GT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var lhe={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(h_.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}};GT.YAMLSet=_a;GT.set=lhe});var WT=v(g_=>{"use strict";var uhe=ul();function VT(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 d6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return uhe.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 dhe={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})=>VT(t,r),stringify:d6},fhe={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=>VT(t,!1),stringify:d6},f6={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(f6.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=VT(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=fhe;g_.intTime=dhe;g_.timestamp=f6});var h6=v(m6=>{"use strict";var phe=cl(),mhe=n_(),hhe=ll(),ghe=Ef(),yhe=MT(),p6=a6(),KT=c6(),y_=u6(),_he=Ky(),bhe=UT(),vhe=u_(),She=ZT(),JT=WT(),whe=[phe.map,hhe.seq,ghe.string,mhe.nullTag,p6.trueTag,p6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,KT.floatNaN,KT.floatExp,KT.float,yhe.binary,_he.merge,bhe.omap,vhe.pairs,She.set,JT.intTime,JT.floatTime,JT.timestamp];m6.schema=whe});var k6=v(QT=>{"use strict";var b6=cl(),xhe=n_(),v6=ll(),$he=Ef(),khe=OT(),YT=IT(),XT=CT(),Ehe=WH(),Ahe=YH(),S6=MT(),If=Ky(),w6=UT(),x6=u_(),g6=h6(),$6=ZT(),__=WT(),y6=new Map([["core",Ehe.schema],["failsafe",[b6.map,v6.seq,$he.string]],["json",Ahe.schema],["yaml11",g6.schema],["yaml-1.1",g6.schema]]),_6={binary:S6.binary,bool:khe.boolTag,float:YT.float,floatExp:YT.floatExp,floatNaN:YT.floatNaN,floatTime:__.floatTime,int:XT.int,intHex:XT.intHex,intOct:XT.intOct,intTime:__.intTime,map:b6.map,merge:If.merge,null:xhe.nullTag,omap:w6.omap,pairs:x6.pairs,seq:v6.seq,set:$6.set,timestamp:__.timestamp},The={"tag:yaml.org,2002:binary":S6.binary,"tag:yaml.org,2002:merge":If.merge,"tag:yaml.org,2002:omap":w6.omap,"tag:yaml.org,2002:pairs":x6.pairs,"tag:yaml.org,2002:set":$6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function Ohe(t,e,r){let n=y6.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(y6.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"?_6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(_6).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},[])}QT.coreKnownTags=The;QT.getTags=Ohe});var rO=v(E6=>{"use strict";var eO=De(),Rhe=cl(),Ihe=ll(),Phe=Ef(),b_=k6(),Che=(t,e)=>t.keye.key?1:0,tO=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,eO.MAP,{value:Rhe.map}),Object.defineProperty(this,eO.SCALAR,{value:Phe.string}),Object.defineProperty(this,eO.SEQ,{value:Ihe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Che:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};E6.Schema=tO});var T6=v(A6=>{"use strict";var Dhe=De(),nO=xf(),Pf=bf();function Nhe(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=nO.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(Dhe.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=nO.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(nO.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(` `)+` -`}E6.stringifyDocument=Ahe});var Pf=v(T6=>{"use strict";var The=gf(),ul=Ly(),Rn=De(),Ohe=Xo(),Rhe=Wo(),Ihe=rO(),Phe=A6(),iO=Ny(),Che=cT(),Dhe=yf(),oO=aT(),sO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 oO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.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=iO.anchorNames(this);e.anchor=!r||n.has(r)?iO.findNewAnchor(r||"a",n):r}return new The.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}=iO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=Dhe.createNode(e,u,m);return a&&Rn.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 Ohe.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 Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return ul.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return ul.isEmptyPath(e)?this.contents!==void 0:Rn.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 oO.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 oO.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 Ihe.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=Rhe.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"?Che.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 Phe.stringifyDocument(this,e)}};function dl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=sO});var Nf=v(Df=>{"use strict";var Cf=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},aO=class extends Cf{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cO=class extends Cf{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Nhe=(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 +`}A6.stringifyDocument=Nhe});var Cf=v(O6=>{"use strict";var jhe=yf(),dl=Ly(),Rn=De(),Mhe=Xo(),Fhe=Wo(),Lhe=rO(),zhe=T6(),iO=Ny(),Uhe=cT(),qhe=_f(),oO=aT(),sO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 oO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){fl(this.contents)&&this.contents.add(e)}addIn(e,r){fl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=iO.anchorNames(this);e.anchor=!r||n.has(r)?iO.findNewAnchor(r||"a",n):r}return new jhe.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}=iO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=qhe.createNode(e,u,m);return a&&Rn.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 Mhe.Pair(i,o)}delete(e){return fl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):fl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return dl.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dl.isEmptyPath(e)?this.contents!==void 0:Rn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=dl.collectionFromPath(this.schema,[e],r):fl(this.contents)&&this.contents.set(e,r)}setIn(e,r){dl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=dl.collectionFromPath(this.schema,Array.from(e),r):fl(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 oO.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 oO.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 Lhe.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=Fhe.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"?Uhe.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 zhe.stringifyDocument(this,e)}};function fl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}O6.Document=sO});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}},aO=class extends Df{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cO=class extends Df{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Hhe=(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} -`}};Df.YAMLError=Cf;Df.YAMLParseError=aO;Df.YAMLWarning=cO;Df.prettifyError=Nhe});var jf=v(O6=>{"use strict";function jhe(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}}O6.resolveProps=jhe});var v_=v(R6=>{"use strict";function lO(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(lO(e.key)||lO(e.value))return!0}return!1;default:return!0}}R6.containsNewline=lO});var uO=v(I6=>{"use strict";var Mhe=v_();function Fhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Mhe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}I6.flowIndentCheck=Fhe});var dO=v(C6=>{"use strict";var P6=De();function Lhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||P6.isScalar(o)&&P6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}C6.mapIncludes=Lhe});var L6=v(F6=>{"use strict";var D6=Xo(),zhe=es(),N6=jf(),Uhe=v_(),j6=uO(),qhe=dO(),M6="All mapping items must start at the same column";function Hhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??zhe.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=N6.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",M6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` -`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Uhe.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",M6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&j6.flowIndentCheck(n.indent,f,i),r.atKey=!1,qhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=N6.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 Bhe=ts(),Ghe=jf(),Zhe=uO();function Vhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Bhe.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=Ghe.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}z6.resolveBlockSeq=Vhe});var fl=v(q6=>{"use strict";function Whe(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}}q6.resolveEnd=Whe});var Z6=v(G6=>{"use strict";var Khe=De(),Jhe=Xo(),H6=es(),Yhe=ts(),Xhe=fl(),B6=jf(),Qhe=v_(),ege=dO(),fO="Block collections are not allowed within flow collections",pO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?H6.YAMLMap:Yhe.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=Xhe.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}G6.resolveFlowCollection=tge});var W6=v(V6=>{"use strict";var rge=De(),nge=Dt(),ige=es(),oge=ts(),sge=L6(),age=U6(),cge=Z6();function mO(t,e,r,n,i,o){let s=r.type==="block-map"?sge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?age.resolveBlockSeq(t,e,r,n,o):cge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function lge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mO(t,e,r,i,s)}let l=mO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=rge.isNode(u)?u:new nge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}V6.composeCollection=lge});var gO=v(K6=>{"use strict";var hO=Dt();function uge(t,e,r){let n=e.offset,i=dge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hO.Scalar.BLOCK_FOLDED:hO.Scalar.BLOCK_LITERAL,s=e.source?fge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`}};Nf.YAMLError=Df;Nf.YAMLParseError=aO;Nf.YAMLWarning=cO;Nf.prettifyError=Hhe});var Mf=v(R6=>{"use strict";function Bhe(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}}R6.resolveProps=Bhe});var v_=v(I6=>{"use strict";function lO(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(lO(e.key)||lO(e.value))return!0}return!1;default:return!0}}I6.containsNewline=lO});var uO=v(P6=>{"use strict";var Ghe=v_();function Zhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ghe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}P6.flowIndentCheck=Zhe});var dO=v(D6=>{"use strict";var C6=De();function Vhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||C6.isScalar(o)&&C6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}D6.mapIncludes=Vhe});var z6=v(L6=>{"use strict";var N6=Xo(),Whe=es(),j6=Mf(),Khe=v_(),M6=uO(),Jhe=dO(),F6="All mapping items must start at the same column";function Yhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Whe.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=j6.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",F6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Khe.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",F6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&M6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Jhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=j6.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 Xhe=ts(),Qhe=Mf(),ege=uO();function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xhe.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=Qhe.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&&ege.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}U6.resolveBlockSeq=tge});var pl=v(H6=>{"use strict";function rge(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}}H6.resolveEnd=rge});var V6=v(Z6=>{"use strict";var nge=De(),ige=Xo(),B6=es(),oge=ts(),sge=pl(),G6=Mf(),age=v_(),cge=dO(),fO="Block collections are not allowed within flow collections",pO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?B6.YAMLMap:oge.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=sge.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Z6.resolveFlowCollection=lge});var K6=v(W6=>{"use strict";var uge=De(),dge=Dt(),fge=es(),pge=ts(),mge=z6(),hge=q6(),gge=V6();function mO(t,e,r,n,i,o){let s=r.type==="block-map"?mge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?hge.resolveBlockSeq(t,e,r,n,o):gge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function yge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mO(t,e,r,i,s)}let l=mO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=uge.isNode(u)?u:new dge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}W6.composeCollection=yge});var gO=v(J6=>{"use strict";var hO=Dt();function _ge(t,e,r){let n=e.offset,i=bge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hO.Scalar.BLOCK_FOLDED:hO.Scalar.BLOCK_LITERAL,s=e.source?vge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` @@ -112,87 +112,87 @@ ${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 dge({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 yO=Dt(),pge=fl();function mge(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=yO.Scalar.PLAIN,c=hge(o,l);break;case"single-quoted-scalar":a=yO.Scalar.QUOTE_SINGLE,c=gge(o,l);break;case"double-quoted-scalar":a=yO.Scalar.QUOTE_DOUBLE,c=yge(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=pge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function hge(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}`),J6(t)}function gge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),J6(t.slice(1,-1)).replace(/''/g,"'")}function J6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var yO=Dt(),Sge=pl();function wge(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=yO.Scalar.PLAIN,c=xge(o,l);break;case"single-quoted-scalar":a=yO.Scalar.QUOTE_SINGLE,c=$ge(o,l);break;case"double-quoted-scalar":a=yO.Scalar.QUOTE_DOUBLE,c=kge(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=Sge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function xge(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}`),Y6(t)}function $ge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Y6(t.slice(1,-1)).replace(/''/g,"'")}function Y6(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function _ge(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` +`)&&(r+=n>o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Ege(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` -`),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var bge={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function vge(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}Y6.resolveFlowScalar=mge});var eB=v(Q6=>{"use strict";var ba=De(),X6=Dt(),Sge=gO(),wge=_O();function xge(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Sge.resolveBlockScalar(t,e,n):wge.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=kge(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 X6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new X6.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 kge({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}Q6.composeScalar=xge});var rB=v(tB=>{"use strict";function Ege(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}tB.emptyScalarPosition=Ege});var oB=v(vO=>{"use strict";var Age=gf(),Tge=De(),Oge=W6(),nB=eB(),Rge=fl(),Ige=rB(),Pge={composeNode:iB,composeEmptyNode:bO};function iB(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=Cge(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=nB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Oge.composeCollection(Pge,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=bO(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&&(!Tge.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 bO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Ige.emptyScalarPosition(e,r,n),indent:-1,source:""},d=nB.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 Cge({options:t},{offset:e,source:r,end:n},i){let o=new Age.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=Rge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vO.composeEmptyNode=bO;vO.composeNode=iB});var cB=v(aB=>{"use strict";var Dge=Pf(),sB=oB(),Nge=fl(),jge=jf();function Mge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new Dge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=jge.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?sB.composeNode(l,i,u,s):sB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Nge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}aB.composeDoc=Mge});var wO=v(dB=>{"use strict";var Fge=Ge("process"),Lge=aT(),zge=Pf(),Mf=Nf(),lB=De(),Uge=cB(),qge=fl();function Ff(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 uB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ba=De(),Q6=Dt(),Oge=gO(),Rge=_O();function Ige(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Oge.resolveBlockScalar(t,e,n):Rge.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=Pge(t.schema,i,c,r,n):e.type==="scalar"?l=Cge(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 Q6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new Q6.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 Pge(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 Cge({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}eB.composeScalar=Ige});var nB=v(rB=>{"use strict";function Dge(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}rB.emptyScalarPosition=Dge});var sB=v(vO=>{"use strict";var Nge=yf(),jge=De(),Mge=K6(),iB=tB(),Fge=pl(),Lge=nB(),zge={composeNode:oB,composeEmptyNode:bO};function oB(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=Uge(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=iB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Mge.composeCollection(zge,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=bO(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&&(!jge.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 bO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Lge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=iB.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 Uge({options:t},{offset:e,source:r,end:n},i){let o=new Nge.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=Fge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vO.composeEmptyNode=bO;vO.composeNode=oB});var lB=v(cB=>{"use strict";var qge=Cf(),aB=sB(),Hge=pl(),Bge=Mf();function Gge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Bge.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?aB.composeNode(l,i,u,s):aB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Hge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}cB.composeDoc=Gge});var wO=v(fB=>{"use strict";var Zge=Ze("process"),Vge=aT(),Wge=Cf(),Ff=jf(),uB=De(),Kge=lB(),Jge=pl();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 dB(t){let e="",r=!1,n=!1;for(let i=0;i{let s=Ff(r);o?this.warnings.push(new Mf.YAMLWarning(s,n,i)):this.errors.push(new Mf.YAMLParseError(s,n,i))},this.directives=new Lge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=uB(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(lB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];lB.isPair(s)&&(s=s.key);let a=s.commentBefore;s.commentBefore=a?`${n} +`)+(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 SO=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 Vge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=dB(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(uB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];uB.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=Ff(e);o[0]+=r,this.onError(o,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let r=Uge.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 Mf.YAMLParseError(Ff(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 Mf.YAMLParseError(Ff(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;let r=qge.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 Mf.YAMLParseError(Ff(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 zge.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}}};dB.Composer=SO});var mB=v(S_=>{"use strict";var Hge=gO(),Bge=_O(),Gge=Nf(),fB=Sf();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 Gge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Bge.resolveFlowScalar(t,e,n);case"block-scalar":return Hge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function Vge(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=fB.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=Kge.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 Wge.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}}};fB.Composer=SO});var hB=v(S_=>{"use strict";var Yge=gO(),Xge=_O(),Qge=jf(),pB=wf();function eye(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 Qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Xge.resolveFlowScalar(t,e,n);case"block-scalar":return Yge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function tye(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=pB.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 pB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function Wge(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=fB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":Kge(t,c);break;case'"':xO(t,c,"double-quoted-scalar");break;case"'":xO(t,c,"single-quoted-scalar");break;default:xO(t,c,"scalar")}}function Kge(t,e){let r=e.indexOf(` +`,f=[{type:"block-scalar-header",offset:o,indent:n,source:u}];return mB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function rye(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=pB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":nye(t,c);break;case'"':xO(t,c,"double-quoted-scalar");break;case"'":xO(t,c,"single-quoted-scalar");break;default:xO(t,c,"scalar")}}function nye(t,e){let r=e.indexOf(` `),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}];pB(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 pB(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 xO(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})}}}S_.createScalarToken=Vge;S_.resolveAsScalar=Zge;S_.setScalarValue=Wge});var gB=v(hB=>{"use strict";var Jge=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}hB.stringify=Jge});var vB=v(bB=>{"use strict";var $O=Symbol("break visit"),Yge=Symbol("skip children"),yB=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),_B(Object.freeze([]),t,e)}va.BREAK=$O;va.SKIP=Yge;va.REMOVE=yB;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 _B(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 kO=mB(),Xge=gB(),Qge=vB(),EO="\uFEFF",AO="",TO="",OO="",eye=t=>!!t&&"items"in t,tye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function rye(t){switch(t){case EO:return"";case AO:return"";case TO:return"";case OO:return"";default:return JSON.stringify(t)}}function nye(t){switch(t){case EO:return"byte-order-mark";case AO:return"doc-mode";case TO:return"flow-error-end";case OO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`;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}];mB(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 mB(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 xO(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})}}}S_.createScalarToken=tye;S_.resolveAsScalar=eye;S_.setScalarValue=rye});var yB=v(gB=>{"use strict";var iye=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}gB.stringify=iye});var SB=v(vB=>{"use strict";var $O=Symbol("break visit"),oye=Symbol("skip children"),_B=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),bB(Object.freeze([]),t,e)}va.BREAK=$O;va.SKIP=oye;va.REMOVE=_B;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 bB(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 kO=hB(),sye=yB(),aye=SB(),EO="\uFEFF",AO="",TO="",OO="",cye=t=>!!t&&"items"in t,lye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function uye(t){switch(t){case EO:return"";case AO:return"";case TO:return"";case OO:return"";default:return JSON.stringify(t)}}function dye(t){switch(t){case EO:return"byte-order-mark";case AO:return"doc-mode";case TO:return"flow-error-end";case OO: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=kO.createScalarToken;Mr.resolveAsScalar=kO.resolveAsScalar;Mr.setScalarValue=kO.setScalarValue;Mr.stringify=Xge.stringify;Mr.visit=Qge.visit;Mr.BOM=EO;Mr.DOCUMENT=AO;Mr.FLOW_END=TO;Mr.SCALAR=OO;Mr.isCollection=eye;Mr.isScalar=tye;Mr.prettyToken=rye;Mr.tokenType=nye});var PO=v(wB=>{"use strict";var Lf=$_();function Qn(t){switch(t){case void 0:case" ":case` -`:case"\r":case" ":return!0;default:return!1}}var SB=new Set("0123456789ABCDEFabcdef"),iye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),oye=new Set(` ,[]{} -\r `),RO=t=>!t||oye.has(t),IO=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===` +`: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=kO.createScalarToken;Mr.resolveAsScalar=kO.resolveAsScalar;Mr.setScalarValue=kO.setScalarValue;Mr.stringify=sye.stringify;Mr.visit=aye.visit;Mr.BOM=EO;Mr.DOCUMENT=AO;Mr.FLOW_END=TO;Mr.SCALAR=OO;Mr.isCollection=cye;Mr.isScalar=lye;Mr.prettyToken=uye;Mr.tokenType=dye});var PO=v(xB=>{"use strict";var zf=$_();function Qn(t){switch(t){case void 0:case" ":case` +`:case"\r":case" ":return!0;default:return!1}}var wB=new Set("0123456789ABCDEFabcdef"),fye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),pye=new Set(` ,[]{} +\r `),RO=t=>!t||pye.has(t),IO=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(RO),"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(RO),"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 Lf.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===` +`&&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&&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 Lf.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(RO),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(iye.has(r))r=this.buffer[++e];else if(r==="%"&&SB.has(this.buffer[e+1])&&SB.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===` +`){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(RO),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(fye.has(r))r=this.buffer[++e];else if(r==="%"&&wB.has(this.buffer[e+1])&&wB.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)}};wB.Lexer=IO});var DO=v(xB=>{"use strict";var CO=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 sye=Ge("process"),$B=$_(),aye=PO();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"&&EB(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&&kB(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)}};xB.Lexer=IO});var DO=v($B=>{"use strict";var CO=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 mye=Ze("process"),kB=$_(),hye=PO();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"&&AB(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&&EB(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(AB(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);EB(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(TB(r.key)&&!rs(r.sep,"newline")){let s=ml(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=ml(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=ml(i);AB(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=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())}}};TB.Parser=NO});var CB=v(Uf=>{"use strict";var OB=wO(),cye=Pf(),zf=Nf(),lye=vT(),uye=De(),dye=DO(),RB=jO();function IB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new dye.LineCounter||null,prettyErrors:e}}function fye(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.Composer(e),s=Array.from(o.compose(i.parse(t)));if(n&&r)for(let a of s)a.errors.forEach(zf.prettifyError(t,r)),a.warnings.forEach(zf.prettifyError(t,r));return s.length>0?s:Object.assign([],{empty:!0},o.streamInfo())}function PB(t,e={}){let{lineCounter:r,prettyErrors:n}=IB(e),i=new RB.Parser(r?.addNewLine),o=new OB.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 zf.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(s.errors.forEach(zf.prettifyError(t,r)),s.warnings.forEach(zf.prettifyError(t,r))),s}function pye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=PB(t,r);if(!i)return null;if(i.warnings.forEach(o=>lye.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 mye(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 uye.isDocument(t)&&!n?t.toString(r):new cye.Document(t,n,r).toString(r)}Uf.parse=pye;Uf.parseAllDocuments=fye;Uf.parseDocument=PB;Uf.stringify=mye});var tr=v(Ze=>{"use strict";var hye=wO(),gye=Pf(),yye=rO(),MO=Nf(),_ye=gf(),ns=De(),bye=Xo(),vye=Dt(),Sye=es(),wye=ts(),xye=$_(),$ye=PO(),kye=DO(),Eye=jO(),T_=CB(),DB=ff();Ze.Composer=hye.Composer;Ze.Document=gye.Document;Ze.Schema=yye.Schema;Ze.YAMLError=MO.YAMLError;Ze.YAMLParseError=MO.YAMLParseError;Ze.YAMLWarning=MO.YAMLWarning;Ze.Alias=_ye.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=bye.Pair;Ze.Scalar=vye.Scalar;Ze.YAMLMap=Sye.YAMLMap;Ze.YAMLSeq=wye.YAMLSeq;Ze.CST=xye;Ze.Lexer=$ye.Lexer;Ze.LineCounter=kye.LineCounter;Ze.Parser=Eye.Parser;Ze.parse=T_.parse;Ze.parseAllDocuments=T_.parseAllDocuments;Ze.parseDocument=T_.parseDocument;Ze.stringify=T_.stringify;Ze.visit=DB.visit;Ze.visitAsync=DB.visitAsync});import{execFileSync as FO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as Aye}from"node:path";function Tye(t){try{let e=FO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Aye(t,e):null}catch{return null}}function LO(t){let e=Tye(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 Sa(t){return LO(t)!==null}function qf(t,e){try{let r=FO("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 qf(t,e)!==null}function NB(t,e){try{let r=FO("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 Oye}from"node:child_process";import{existsSync as Rye,readFileSync as Iye}from"node:fs";import{join as MB}from"node:path";function gl(t,e){return Oye("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){FB(t,e);let r=gl(t,["rev-parse","HEAD"]).trim(),n=Pye(t,e);return{groups:Cye(t,n),head:r,inventory:{after:jB(C_(t,"spec.yaml")),before:jB(Hf(t,e,"spec.yaml"))},since:e,unsharded_commits:Mye(t,e)}}function zO(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 FB(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 Pye(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(Hf(t,e,a));l&&n.push(ml(l,"archived"))}else{let l=hl(C_(t,c));if(!l)continue;let d=hl(Hf(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 LB(t,e){FB(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(Hf(t,"HEAD",c)):null,f=l?null:hl(Hf(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=>zO(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=MB(t,e);if(!Rye(r))return null;try{return Iye(r,"utf8")}catch{return null}}function Hf(t,e,r){try{return gl(t,["show",`${e}:${r}`])}catch{return null}}function Cye(t,e){let r=Dye(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 Dye(t){let e=C_(t,MB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function jB(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 Mye(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);Nye.test(a)&&(jye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Nye,jye,yl=y(()=>{"use strict";D_=wt(tr(),1);wa();Nye=/^(feat|fix)(\([^)]*\))?!?:/,jye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as zB}from"node:child_process";import{appendFileSync as Fye,existsSync as UO,mkdirSync as Lye,readFileSync as zye,renameSync as Uye,statSync as qye}from"node:fs";import{userInfo as Hye}from"node:os";import{dirname as Bye,join as HO}from"node:path";function BO(t){return HO(t,UB,Gye)}function rn(t,e){let r=BO(t),n=Bye(r);UO(n)||Lye(n,{recursive:!0});try{UO(r)&&qye(r).size>Zye&&Uye(r,HO(n,qB))}catch{}Fye(r,`${JSON.stringify(e)} -`,"utf8")}function qO(t){if(!UO(t))return[];let e=zye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return qO(BO(t))}function N_(t){return[...qO(HO(t,UB,qB)),...qO(BO(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 Vye(t){let e;try{e=zB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Hye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function Wye(t){try{return zB("git",["rev-parse","HEAD"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()}catch{return}}function Bf(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=Wye(t),i=Vye(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 UB,Gye,qB,Zye,Fr=y(()=>{"use strict";UB=".cladding",Gye="events.log.jsonl",qB="events.log.1.jsonl",Zye=5*1024*1024});import{execFileSync as Kye}from"node:child_process";import{existsSync as HB,readdirSync as Jye,readFileSync as Yye,statSync as BB}from"node:fs";import{createHash as Xye}from"node:crypto";import{join as GO}from"node:path";function xa(t){try{return Kye("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function ZO(t){let e=[],r=GO(t,"spec.yaml");HB(r)&&BB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=GO(t,"spec",i);if(!(!HB(o)||!BB(o).isDirectory()))for(let s of Jye(o))s.endsWith(".yaml")&&e.push(GO(o,s))}e.sort();let n=Xye("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(Yye(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:ZO(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 Gf=y(()=>{"use strict";Fr()});import{readFileSync as Qye,statSync as e_e}from"node:fs";import{extname as t_e,resolve as VO,sep as r_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function o_e(t,e){let r=VO(e),n=VO(r,t);return n===r||n.startsWith(r+r_e)}function ZB(t,e,r,n){if(!o_e(t,e))return{path:t,omitted:"unsafe-path"};if(!n_e.has(t_e(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>GB)return{path:t,omitted:"too-large",bytes:o}}else{let l=VO(e,t);try{o=e_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>GB)return{path:t,omitted:"too-large",bytes:o};try{i=Qye(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(i_e))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=` +`,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=ml(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=ml(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())}}};OB.Parser=NO});var DB=v(qf=>{"use strict";var RB=wO(),gye=Cf(),Uf=jf(),yye=vT(),_ye=De(),bye=DO(),IB=jO();function PB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bye.LineCounter||null,prettyErrors:e}}function vye(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 CB(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 Sye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=CB(t,r);if(!i)return null;if(i.warnings.forEach(o=>yye.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 wye(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 _ye.isDocument(t)&&!n?t.toString(r):new gye.Document(t,n,r).toString(r)}qf.parse=Sye;qf.parseAllDocuments=vye;qf.parseDocument=CB;qf.stringify=wye});var tr=v(Ve=>{"use strict";var xye=wO(),$ye=Cf(),kye=rO(),MO=jf(),Eye=yf(),ns=De(),Aye=Xo(),Tye=Dt(),Oye=es(),Rye=ts(),Iye=$_(),Pye=PO(),Cye=DO(),Dye=jO(),T_=DB(),NB=pf();Ve.Composer=xye.Composer;Ve.Document=$ye.Document;Ve.Schema=kye.Schema;Ve.YAMLError=MO.YAMLError;Ve.YAMLParseError=MO.YAMLParseError;Ve.YAMLWarning=MO.YAMLWarning;Ve.Alias=Eye.Alias;Ve.isAlias=ns.isAlias;Ve.isCollection=ns.isCollection;Ve.isDocument=ns.isDocument;Ve.isMap=ns.isMap;Ve.isNode=ns.isNode;Ve.isPair=ns.isPair;Ve.isScalar=ns.isScalar;Ve.isSeq=ns.isSeq;Ve.Pair=Aye.Pair;Ve.Scalar=Tye.Scalar;Ve.YAMLMap=Oye.YAMLMap;Ve.YAMLSeq=Rye.YAMLSeq;Ve.CST=Iye;Ve.Lexer=Pye.Lexer;Ve.LineCounter=Cye.LineCounter;Ve.Parser=Dye.Parser;Ve.parse=T_.parse;Ve.parseAllDocuments=T_.parseAllDocuments;Ve.parseDocument=T_.parseDocument;Ve.stringify=T_.stringify;Ve.visit=NB.visit;Ve.visitAsync=NB.visitAsync});import{execFileSync as FO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as Nye}from"node:path";function jye(t){try{let e=FO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Nye(t,e):null}catch{return null}}function LO(t){let e=jye(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 Sa(t){return LO(t)!==null}function Hf(t,e){try{let r=FO("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 jB(t,e){try{let r=FO("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 Mye}from"node:child_process";import{existsSync as Fye,readFileSync as Lye}from"node:fs";import{join as FB}from"node:path";function yl(t,e){return Mye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=yl(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){LB(t,e);let r=yl(t,["rev-parse","HEAD"]).trim(),n=zye(t,e);return{groups:Uye(t,n),head:r,inventory:{after:MB(C_(t,"spec.yaml")),before:MB(Bf(t,e,"spec.yaml"))},since:e,unsharded_commits:Gye(t,e)}}function zO(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 LB(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 zye(t,e){let r=yl(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=gl(C_(t,c));if(!l)continue;l.status==="done"?n.push(hl(l,"added-as-done")):l.status==="archived"&&n.push(hl(l,"archived"))}else if(s.startsWith("D")){let l=gl(Bf(t,e,a));l&&n.push(hl(l,"archived"))}else{let l=gl(C_(t,c));if(!l)continue;let d=gl(Bf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(hl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(hl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(hl(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 zB(t,e){LB(t,e);let r=yl(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?gl(Bf(t,"HEAD",c)):null,f=l?null:gl(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 hl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>zO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function gl(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=FB(t,e);if(!Fye(r))return null;try{return Lye(r,"utf8")}catch{return null}}function Bf(t,e,r){try{return yl(t,["show",`${e}:${r}`])}catch{return null}}function Uye(t,e){let r=qye(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 qye(t){let e=C_(t,FB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function MB(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 Gye(t,e){let r=yl(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);Hye.test(a)&&(Bye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Hye,Bye,_l=y(()=>{"use strict";D_=wt(tr(),1);wa();Hye=/^(feat|fix)(\([^)]*\))?!?:/,Bye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as UB}from"node:child_process";import{appendFileSync as Zye,existsSync as UO,mkdirSync as Vye,readFileSync as Wye,renameSync as Kye,statSync as Jye}from"node:fs";import{userInfo as Yye}from"node:os";import{dirname as Xye,join as HO}from"node:path";function BO(t){return HO(t,qB,Qye)}function rn(t,e){let r=BO(t),n=Xye(r);UO(n)||Vye(n,{recursive:!0});try{UO(r)&&Jye(r).size>e_e&&Kye(r,HO(n,HB))}catch{}Zye(r,`${JSON.stringify(e)} +`,"utf8")}function qO(t){if(!UO(t))return[];let e=Wye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return qO(BO(t))}function N_(t){return[...qO(HO(t,qB,HB)),...qO(BO(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 t_e(t){let e;try{e=UB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Yye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function r_e(t){try{return UB("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=r_e(t),i=t_e(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 qB,Qye,HB,e_e,Fr=y(()=>{"use strict";qB=".cladding",Qye="events.log.jsonl",HB="events.log.1.jsonl",e_e=5*1024*1024});import{execFileSync as n_e}from"node:child_process";import{existsSync as BB,readdirSync as i_e,readFileSync as o_e,statSync as GB}from"node:fs";import{createHash as s_e}from"node:crypto";import{join as GO}from"node:path";function xa(t){try{return n_e("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function ZO(t){let e=[],r=GO(t,"spec.yaml");BB(r)&&GB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=GO(t,"spec",i);if(!(!BB(o)||!GB(o).isDirectory()))for(let s of i_e(o))s.endsWith(".yaml")&&e.push(GO(o,s))}e.sort();let n=s_e("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(o_e(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:ZO(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 a_e,statSync as c_e}from"node:fs";import{extname as l_e,resolve as VO,sep as u_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function p_e(t,e){let r=VO(e),n=VO(r,t);return n===r||n.startsWith(r+u_e)}function VB(t,e,r,n){if(!p_e(t,e))return{path:t,omitted:"unsafe-path"};if(!d_e.has(l_e(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>ZB)return{path:t,omitted:"too-large",bytes:o}}else{let l=VO(e,t);try{o=c_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>ZB)return{path:t,omitted:"too-large",bytes:o};try{i=a_e(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(f_e))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 n_e,GB,i_e,L_=y(()=>{"use strict";n_e=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"]),GB=2e6,i_e="\0"});function Zf(t){for(let i of s_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 WO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function a_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??[])WO(e,s,o);for(let s of i.modules??[])WO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Zf(a);c&&WO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=VB.get(t);return e||(e=a_e(t),VB.set(t,e)),e}var s_e,VB,as=y(()=>{"use strict";s_e=["derived:","fixture:","script:","self-dogfood:"];VB=new WeakMap});function KO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=c_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=KO(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:JO(i)}}var $a=y(()=>{"use strict";as()});function WB(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=In(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=KO(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=WB(_),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_,YO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function l_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 KB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=l_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 JB=y(()=>{"use strict"});function u_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=u_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=KB(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";JB()});import{existsSync as XB,readdirSync as d_e,readFileSync as f_e}from"node:fs";import{join as QO}from"node:path";function eR(t,e=m_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function h_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:eR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:eR(`done reverted \u2014 pre-push strict gate red${r}`)}}function YB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function g_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 eR(n)}function y_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)=>YB(m)-YB(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(-p_e).map(h_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?g_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 XO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function __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 b_e(t,e,r){let n=XO(t,/_Rolled back at_\s*`([^`]+)`/),i=XO(t,/Last failed gate:\s*`([^`]+)`/),o=XO(t,/Retry attempts:\s*(\d+)/),s=__e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function v_e(t,e){let r=QO(t,".cladding","post-mortems");if(!XB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of d_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(b_e(f_e(QO(r,o),"utf8"),e,o))}catch{}return i}function QB(t,e){try{let r=N_(t),n=v_e(t,e),i=XB(QO(t,".cladding","events.log.1.jsonl"));return y_e(r,n,e,{truncated:i})}catch{return}}var p_e,m_e,eG=y(()=>{"use strict";Fr();p_e=5,m_e=120});function H_(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:S_e,o=e,s,a=In(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=QB(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>w_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 S_e,w_e,B_=y(()=>{"use strict";L_();q_();YO();eG();$a();as();S_e=3e3,w_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 x_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 tG(t,e,r="."){let n=In(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=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:x_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_();YO();B_();as();bl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as $_e,existsSync as tR,mkdirSync as k_e,readFileSync as rG}from"node:fs";import{dirname as E_e,join as A_e}from"node:path";function rR(t){return A_e(t,T_e,O_e)}function R_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:ZO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function nG(t,e){try{let r=R_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=nR(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=rR(t),s=E_e(o);return tR(s)||k_e(s,{recursive:!0}),$_e(o,`${JSON.stringify(r)} -`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function iG(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 nR(t,e){let r=rR(t);if(!tR(r))return[];let n;try{n=rG(r,"utf8")}catch{return[]}let i=iG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function oG(t){let e=rR(t);if(!tR(e))return{snapshots:[],unreadable:!1};let r;try{r=rG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=iG(r),i=r.trim().length>0;return{snapshots:n,unreadable:i&&n.length===0}}function Vf(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 sG(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?` (${Vf(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 T_e,O_e,Wf=y(()=>{"use strict";Gf();G_();T_e=".cladding",O_e="measure.jsonl"});import{existsSync as I_e}from"node:fs";import{join as P_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}** (${C_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 cG(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 ${Vf(n.medianSliceTokens-o.context.medianSliceTokens)} \xB7 struct ${Vf(n.medianStructuralRatio-o.context.medianStructuralRatio,2)} \xB7 cov ${Vf(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"} | ${N_e(l,r)} |`)}return n.join(` -`)}function N_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 D_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${I_e(P_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),aG(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)aG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function aG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zO(r);n&&t.push(`- ${n}`)}t.push("")}var C_e,D_e,Z_=y(()=>{"use strict";Wf();G_();yl();C_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};D_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 j_e}from"node:fs";function Ri(t="./spec.yaml"){let e=j_e(t,"utf8");return(0,lG.parse)(e)}var lG,V_=y(()=>{"use strict";lG=wt(tr(),1)});var cs=v((Lr,aR)=>{"use strict";var iR=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+dG(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()};iR.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 iR(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 iR(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};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 M_e(t,e){return e+": "+t.toString()+` -`}W_.prototype.toString=function(e){return this.errors.map(M_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});aR.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 uG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};uG.prototype=Object.create(Error.prototype,{constructor:{value:uG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var oR=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+dG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};oR.prototype.resolve=function(e){return fG(this.base,e)};oR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=fG(this.base,i||"");var s=new oR(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 dG=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 F_e(t,e,r,n){typeof r=="object"?e[n]=sR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function L_e(t,e,r){e[r]=t[r]}function z_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=sR(t[n],e[n]):r[n]=e[n]}function sR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(F_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(L_e.bind(null,t,n)),Object.keys(e).forEach(z_e.bind(null,t,e,n))),n}aR.exports.deepMerge=sR;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 U_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(U_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 fG=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 gG=v((iet,hG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,cR={};cR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=cR.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 lR(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(lR.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(lR.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=lR.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 uR(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(uR(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=uR(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 pG(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&&pG.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)pG.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 q_e(t,e,r){var n,i=r.length;for(n=e+1,i;n{"use strict";var dR=cs();fR.exports.SchemaScanResult=yG;function yG(t,e){this.id=t,this.ref=e}fR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=dR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=dR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!dR.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 _G=gG(),us=cs(),bG=K_().scan,vG=us.ValidatorResult,H_e=us.ValidatorResultError,Kf=us.SchemaError,SG=us.SchemaContext,B_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(_G.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=bG(r||B_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 Kf("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 Kf('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)};xG.exports=Yt});var kG=v((aet,yo)=>{"use strict";var G_e=yo.exports.Validator=$G();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 G_e;return n.validate(t,e,r)}});import{readFileSync as Z_e}from"node:fs";import{dirname as V_e,join as W_e}from"node:path";import{fileURLToPath as K_e}from"node:url";function ebe(t){let e=Q_e.validate(t,X_e);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function AG(t){let e=ebe(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`,c=Math.max(0,s-a.length);return{path:t,text:i.slice(0,c)+a,truncated:!0,bytes:o}}var d_e,ZB,f_e,L_=y(()=>{"use strict";d_e=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"]),ZB=2e6,f_e="\0"});function Vf(t){for(let i of m_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 WO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function h_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??[])WO(e,s,o);for(let s of i.modules??[])WO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vf(a);c&&WO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=WB.get(t);return e||(e=h_e(t),WB.set(t,e)),e}var m_e,WB,as=y(()=>{"use strict";m_e=["derived:","fixture:","script:","self-dogfood:"];WB=new WeakMap});function KO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=g_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=KO(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:JO(i)}}var $a=y(()=>{"use strict";as()});function KB(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=In(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=KO(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=KB(_),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_,YO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function y_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 JB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=y_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 YB=y(()=>{"use strict"});function __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 bl(t,e){let r=__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=JB(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";YB()});import{existsSync as QB,readdirSync as b_e,readFileSync as v_e}from"node:fs";import{join as QO}from"node:path";function eR(t,e=w_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function x_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:eR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:eR(`done reverted \u2014 pre-push strict gate red${r}`)}}function XB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function $_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 eR(n)}function k_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)=>XB(m)-XB(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(-S_e).map(x_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?$_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 XO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function E_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 A_e(t,e,r){let n=XO(t,/_Rolled back at_\s*`([^`]+)`/),i=XO(t,/Last failed gate:\s*`([^`]+)`/),o=XO(t,/Retry attempts:\s*(\d+)/),s=E_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function T_e(t,e){let r=QO(t,".cladding","post-mortems");if(!QB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of b_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(A_e(v_e(QO(r,o),"utf8"),e,o))}catch{}return i}function eG(t,e){try{let r=N_(t),n=T_e(t,e),i=QB(QO(t,".cladding","events.log.1.jsonl"));return k_e(r,n,e,{truncated:i})}catch{return}}var S_e,w_e,tG=y(()=>{"use strict";Fr();S_e=5,w_e=120});function H_(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:O_e,o=e,s,a=In(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=bl(t,o);if("not_found"in c)return c;let l=c.focus,u=eG(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>R_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 O_e,R_e,B_=y(()=>{"use strict";L_();q_();YO();tG();$a();as();O_e=3e3,R_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 I_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 rG(t,e,r="."){let n=In(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=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:I_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 vl,G_=y(()=>{"use strict";L_();YO();B_();as();vl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as P_e,existsSync as tR,mkdirSync as C_e,readFileSync as nG}from"node:fs";import{dirname as D_e,join as N_e}from"node:path";function rR(t){return N_e(t,j_e,M_e)}function F_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:ZO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function iG(t,e){try{let r=F_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=nR(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=rR(t),s=D_e(o);return tR(s)||C_e(s,{recursive:!0}),P_e(o,`${JSON.stringify(r)} +`,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function oG(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 nR(t,e){let r=rR(t);if(!tR(r))return[];let n;try{n=nG(r,"utf8")}catch{return[]}let i=oG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function sG(t){let e=rR(t);if(!tR(e))return{snapshots:[],unreadable:!1};let r;try{r=nG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=oG(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 aG(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(` ${vl}`),i.join(` +`)}var j_e,M_e,Kf=y(()=>{"use strict";Zf();G_();j_e=".cladding",M_e="measure.jsonl"});import{existsSync as L_e}from"node:fs";import{join as z_e}from"node:path";function Sl(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}** (${U_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 lG(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 ${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`,"",vl),r.join(` +`)}function wl(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"} | ${H_e(l,r)} |`)}return n.join(` +`)}function H_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 q_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${L_e(z_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function xl(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),cG(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)cG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` +`)}function cG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zO(r);n&&t.push(`- ${n}`)}t.push("")}var U_e,q_e,Z_=y(()=>{"use strict";Kf();G_();_l();U_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};q_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 B_e}from"node:fs";function Ri(t="./spec.yaml"){let e=B_e(t,"utf8");return(0,uG.parse)(e)}var uG,V_=y(()=>{"use strict";uG=wt(tr(),1)});var cs=v((Lr,aR)=>{"use strict";var iR=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+fG(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()};iR.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 iR(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 iR(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};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 G_e(t,e){return e+": "+t.toString()+` +`}W_.prototype.toString=function(e){return this.errors.map(G_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});aR.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 dG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};dG.prototype=Object.create(Error.prototype,{constructor:{value:dG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var oR=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+fG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};oR.prototype.resolve=function(e){return pG(this.base,e)};oR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=pG(this.base,i||"");var s=new oR(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 fG=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 Z_e(t,e,r,n){typeof r=="object"?e[n]=sR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function V_e(t,e,r){e[r]=t[r]}function W_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=sR(t[n],e[n]):r[n]=e[n]}function sR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Z_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(V_e.bind(null,t,n)),Object.keys(e).forEach(W_e.bind(null,t,e,n))),n}aR.exports.deepMerge=sR;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 K_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(K_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 pG=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 yG=v((yet,gG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,cR={};cR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=cR.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 lR(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(lR.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(lR.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=lR.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 uR(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(uR(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=uR(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 mG(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&&mG.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)mG.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 dR=cs();fR.exports.SchemaScanResult=_G;function _G(t,e){this.id=t,this.ref=e}fR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=dR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=dR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!dR.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 bG=yG(),us=cs(),vG=K_().scan,SG=us.ValidatorResult,Y_e=us.ValidatorResultError,Jf=us.SchemaError,wG=us.SchemaContext,X_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(bG.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=vG(r||X_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)};$G.exports=Yt});var EG=v((vet,yo)=>{"use strict";var Q_e=yo.exports.Validator=kG();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 Q_e;return n.validate(t,e,r)}});import{readFileSync as ebe}from"node:fs";import{dirname as tbe,join as rbe}from"node:path";import{fileURLToPath as nbe}from"node:url";function cbe(t){let e=abe.validate(t,sbe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function TG(t){let e=cbe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var EG,J_e,Y_e,X_e,Q_e,TG=y(()=>{"use strict";EG=wt(kG(),1),J_e=V_e(K_e(import.meta.url)),Y_e=W_e(J_e,"schema.json"),X_e=JSON.parse(Z_e(Y_e,"utf8")),Q_e=new EG.Validator});import{existsSync as pR,readdirSync as tbe}from"node:fs";import{dirname as rbe,join as Aa,resolve as RG}from"node:path";function OG(t){return pR(t)?tbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:RG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&RG(t)===J_.cwd?J_.spec:nbe(t,e)}function nbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,rbe(e),"spec");if(!n.features||n.features.length===0){let o=OG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=OG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");pR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(pR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return AG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import xl from"node:process";function gR(){return!!xl.stdout.isTTY}function L(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";gR()?xl.stdout.write(`${mR[t]}${n}${hR} ${e}${i} -`):xl.stdout.write(`${n} ${e}${i} -`)}function Jf(t,e,r=""){if(!gR())return;let n=r?` ${r}`:"";xl.stdout.write(`${PG}${mR.start}\xB7${hR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=IG[t],i=r?` ${r}`:"";gR()?xl.stdout.write(`${PG}${mR[t]}${n}${hR} ${e}${i} -`):xl.stdout.write(`${n} ${e}${i} -`)}var IG,mR,hR,PG,Pi=y(()=>{"use strict";IG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},mR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},hR="\x1B[0m",PG="\r\x1B[K"});import{createHash as bR}from"node:crypto";import{existsSync as Ube,readFileSync as vR,writeFileSync as qbe}from"node:fs";import{join as Y_}from"node:path";function iZ(t){let e=bR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} -`)}),e.digest("hex")}function Hbe(t,e){let r=bR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(vR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function oZ(t,e){let r=bR("sha256");try{r.update(vR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...nZ);if(!Ube(e))return null;let r;try{r=vR(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)!==oZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Hbe(e,n)?{state:"fresh"}:{state:"stale"}}function sZ(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}: ${oZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Bbe+(r?`policy: + `)}`)}var AG,ibe,obe,sbe,abe,OG=y(()=>{"use strict";AG=wt(EG(),1),ibe=tbe(nbe(import.meta.url)),obe=rbe(ibe,"schema.json"),sbe=JSON.parse(ebe(obe,"utf8")),abe=new AG.Validator});import{existsSync as pR,readdirSync as lbe}from"node:fs";import{dirname as ube,join as Aa,resolve as IG}from"node:path";function RG(t){return pR(t)?lbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:IG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&IG(t)===J_.cwd?J_.spec:dbe(t,e)}function dbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,ube(e),"spec");if(!n.features||n.features.length===0){let o=RG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=RG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");pR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(pR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return TG(n),n}var J_,Ue=y(()=>{"use strict";V_();OG();J_=null});import $l from"node:process";function gR(){return!!$l.stdout.isTTY}function L(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";gR()?$l.stdout.write(`${mR[t]}${n}${hR} ${e}${i} +`):$l.stdout.write(`${n} ${e}${i} +`)}function Yf(t,e,r=""){if(!gR())return;let n=r?` ${r}`:"";$l.stdout.write(`${CG}${mR.start}\xB7${hR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";gR()?$l.stdout.write(`${CG}${mR[t]}${n}${hR} ${e}${i} +`):$l.stdout.write(`${n} ${e}${i} +`)}var PG,mR,hR,CG,Pi=y(()=>{"use strict";PG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},mR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},hR="\x1B[0m",CG="\r\x1B[K"});import{createHash as bR}from"node:crypto";import{existsSync as Kbe,readFileSync as vR,writeFileSync as Jbe}from"node:fs";import{join as Y_}from"node:path";function oZ(t){let e=bR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function Ybe(t,e){let r=bR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(vR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function sZ(t,e){let r=bR("sha256");try{r.update(vR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...iZ);if(!Kbe(e))return null;let r;try{r=vR(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)!==sZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Ybe(e,n)?{state:"fresh"}:{state:"stale"}}function aZ(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}: ${sZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Xbe+(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 qbe(Y_(t,...nZ),a,"utf8"),!0}var nZ,Bbe,kl=y(()=>{"use strict";nZ=["spec","attestation.yaml"];Bbe=`# Cladding \xB7 Tier C \u2014 verification attestation (v2). Written ONLY by a GREEN +`;return Jbe(Y_(t,...iZ),a,"utf8"),!0}var iZ,Xbe,El=y(()=>{"use strict";iZ=["spec","attestation.yaml"];Xbe=`# 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 SR}from"node:path";function eb(t){fs={cwd:SR(t),results:new Map}}function aZ(t,e,r){!fs||fs.cwd!==SR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==SR(e)?null:fs.results.get(t)??null}function rb(){fs=null}var fs,El=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 Gbe}from"node:url";var Al,Zbe,wR,xR,Tl=y(()=>{Al=(t,e)=>{let r=xR(Zbe(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},Zbe=t=>wR(t)?t.toString():t,wR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,xR=t=>t instanceof URL?Gbe(t):t});var nb,$R=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 Vbe}from"node:string_decoder";var cZ,lZ,qt,vo,Wbe,uZ,Kbe,ib,dZ,Jbe,Xf,Ybe,kR,Xbe,an=y(()=>{({toString:cZ}=Object.prototype),lZ=t=>cZ.call(t)==="[object ArrayBuffer]",qt=t=>cZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Wbe=new TextEncoder,uZ=t=>Wbe.encode(t),Kbe=new TextDecoder,ib=t=>Kbe.decode(t),dZ=(t,e)=>Jbe(t,e).join(""),Jbe=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new Vbe(e),n=t.map(o=>typeof o=="string"?uZ(o):o).map(o=>r.write(o)),i=r.end();return i===""?n:[...n,i]},Xf=t=>t.length===1&&qt(t[0])?t[0]:kR(Ybe(t)),Ybe=t=>t.map(e=>typeof e=="string"?uZ(e):e),kR=t=>{let e=new Uint8Array(Xbe(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},Xbe=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as Qbe}from"node:child_process";var hZ,gZ,eve,tve,fZ,rve,pZ,mZ,nve,yZ=y(()=>{bo();an();hZ=t=>Array.isArray(t)&&Array.isArray(t.raw),gZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=eve({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,{}]},eve=({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}=tve(i,t.raw[n]),c=pZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>mZ(d)):[mZ(l)];return pZ(c,u,a)},tve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=fZ.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)],mZ=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 nve(t);throw t instanceof Qbe||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`)},nve=({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 ER from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[ER.stdin,ER.stdout,ER.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as ive}from"node:util";var bZ,AR,ove,sve,ave,cve,_Z,lve,TR,uve,dve,fve,pve,OR,wo,xo=y(()=>{bo();So();bZ=t=>{let e={...t};for(let r of OR)e[r]=AR(t,r);return e},AR=(t,e)=>{let r=Array.from({length:ove(t)+1}),n=sve(t[e],r,e);return dve(n,e)},ove=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,sve=(t,e,r)=>Ot(t)?ave(t,e,r):e.fill(t),ave=(t,e,r)=>{for(let n of Object.keys(t).sort(cve))for(let i of lve(n,r,e))e[i]=t[n];return e},cve=(t,e)=>_Z(t)<_Z(e)?1:-1,_Z=t=>t==="stdout"||t==="stderr"?0:t==="all"?2:1,lve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`});import{resolve as SR}from"node:path";function eb(t){fs={cwd:SR(t),results:new Map}}function cZ(t,e,r){!fs||fs.cwd!==SR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==SR(e)?null:fs.results.get(t)??null}function rb(){fs=null}var fs,Al=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 Qbe}from"node:url";var Tl,eve,wR,xR,Ol=y(()=>{Tl=(t,e)=>{let r=xR(eve(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},eve=t=>wR(t)?t.toString():t,wR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,xR=t=>t instanceof URL?Qbe(t):t});var nb,$R=y(()=>{bo();Ol();nb=(t,e=[],r={})=>{let n=Tl(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 tve}from"node:string_decoder";var lZ,uZ,qt,vo,rve,dZ,nve,ib,fZ,ive,Qf,ove,kR,sve,an=y(()=>{({toString:lZ}=Object.prototype),uZ=t=>lZ.call(t)==="[object ArrayBuffer]",qt=t=>lZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rve=new TextEncoder,dZ=t=>rve.encode(t),nve=new TextDecoder,ib=t=>nve.decode(t),fZ=(t,e)=>ive(t,e).join(""),ive=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new tve(e),n=t.map(o=>typeof o=="string"?dZ(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]:kR(ove(t)),ove=t=>t.map(e=>typeof e=="string"?dZ(e):e),kR=t=>{let e=new Uint8Array(sve(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},sve=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as ave}from"node:child_process";var gZ,yZ,cve,lve,pZ,uve,mZ,hZ,dve,_Z=y(()=>{bo();an();gZ=t=>Array.isArray(t)&&Array.isArray(t.raw),yZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=cve({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,{}]},cve=({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}=lve(i,t.raw[n]),c=mZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>hZ(d)):[hZ(l)];return mZ(c,u,a)},lve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=pZ.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)],hZ=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 dve(t);throw t instanceof ave||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`)},dve=({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 ER from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[ER.stdin,ER.stdout,ER.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as fve}from"node:util";var vZ,AR,pve,mve,hve,gve,bZ,yve,TR,_ve,bve,vve,Sve,OR,wo,xo=y(()=>{bo();So();vZ=t=>{let e={...t};for(let r of OR)e[r]=AR(t,r);return e},AR=(t,e)=>{let r=Array.from({length:pve(t)+1}),n=mve(t[e],r,e);return bve(n,e)},pve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,mve=(t,e,r)=>Ot(t)?hve(t,e,r):e.fill(t),hve=(t,e,r)=>{for(let n of Object.keys(t).sort(gve))for(let i of yve(n,r,e))e[i]=t[n];return e},gve=(t,e)=>bZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,yve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(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]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=uve.exec(t);if(e!==null)return Number(e[1])},uve=/^fd(\d+)$/,dve=(t,e)=>t.map(r=>r===void 0?pve[e]:r),fve=ive("execa").enabled?"full":"none",pve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:fve,stripFinalNewline:!0},OR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Ol,Rl,vZ,RR,mve,ab,cb,ps=y(()=>{xo();Ol=({verbose:t},e)=>RR(t,e)!=="none",Rl=({verbose:t},e)=>!["none","short"].includes(RR(t,e)),vZ=({verbose:t},e)=>{let r=RR(t,e);return ab(r)?r:void 0},RR=(t,e)=>e===void 0?mve(t):wo(t,e),mve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as hve}from"node:process";import{stripVTControlCharacters as gve}from"node:util";var SZ,Qf,wZ,yve,_ve,bve,vve,Sve,wve,xve,lb=y(()=>{SZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>wve(wZ(o))).join(" ");return{command:n,escapedCommand:i}},Qf=t=>gve(t).split(` -`).map(e=>wZ(e)).join(` -`),wZ=t=>t.replaceAll(bve,e=>yve(e)),yve=t=>{let e=vve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Sve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},_ve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},bve=_ve(),vve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Sve=65535,wve=t=>xve.test(t)?t:hve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,xve=/^[\w./-]+$/});import xZ from"node:process";function IR(){let{env:t}=xZ,{TERM:e,TERM_PROGRAM:r}=t;return xZ.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 $Z=y(()=>{});var kZ,EZ,$ve,kve,Eve,Ave,Tve,ub,gtt,AZ=y(()=>{$Z();kZ={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"},EZ={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"},kve={...kZ,...EZ},Eve={...kZ,...$ve},Ave=IR(),Tve=Ave?kve:Eve,ub=Tve,gtt=Object.entries(EZ)});import Ove from"node:tty";var Rve,ve,btt,TZ,vtt,Stt,wtt,xtt,$tt,ktt,Ett,Att,Ttt,Ott,Rtt,Itt,Ptt,Ctt,Dtt,db,Ntt,jtt,Mtt,Ftt,Ltt,ztt,Utt,qtt,Htt,OZ,Btt,RZ,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,Ytt,Xtt,Qtt,ert,trt,PR=y(()=>{Rve=Ove?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Rve)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}},btt=ve(0,0),TZ=ve(1,22),vtt=ve(2,22),Stt=ve(3,23),wtt=ve(4,24),xtt=ve(53,55),$tt=ve(7,27),ktt=ve(8,28),Ett=ve(9,29),Att=ve(30,39),Ttt=ve(31,39),Ott=ve(32,39),Rtt=ve(33,39),Itt=ve(34,39),Ptt=ve(35,39),Ctt=ve(36,39),Dtt=ve(37,39),db=ve(90,39),Ntt=ve(40,49),jtt=ve(41,49),Mtt=ve(42,49),Ftt=ve(43,49),Ltt=ve(44,49),ztt=ve(45,49),Utt=ve(46,49),qtt=ve(47,49),Htt=ve(100,49),OZ=ve(91,39),Btt=ve(92,39),RZ=ve(93,39),Gtt=ve(94,39),Ztt=ve(95,39),Vtt=ve(96,39),Wtt=ve(97,39),Ktt=ve(101,49),Jtt=ve(102,49),Ytt=ve(103,49),Xtt=ve(104,49),Qtt=ve(105,49),ert=ve(106,49),trt=ve(107,49)});var IZ=y(()=>{PR();PR()});var DZ,Pve,fb,PZ,Cve,CZ,Dve,NZ=y(()=>{AZ();IZ();DZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=Pve(r),c=Cve[t]({failed:o,reject:s,piped:n}),l=Dve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},Pve=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"),PZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Cve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:PZ,duration:PZ},CZ=t=>t,Dve={command:()=>TZ,output:()=>CZ,ipc:()=>CZ,error:({reject:t})=>t?OZ:RZ,duration:()=>db}});var jZ,Nve,jve,MZ=y(()=>{ps();jZ=(t,e,r)=>{let n=vZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Nve(i,o,n)).filter(i=>i!==void 0).map(i=>jve(i)).join("")},Nve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},jve=t=>t.endsWith(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=_ve.exec(t);if(e!==null)return Number(e[1])},_ve=/^fd(\d+)$/,bve=(t,e)=>t.map(r=>r===void 0?Sve[e]:r),vve=fve("execa").enabled?"full":"none",Sve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:vve,stripFinalNewline:!0},OR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Rl,Il,SZ,RR,wve,ab,cb,ps=y(()=>{xo();Rl=({verbose:t},e)=>RR(t,e)!=="none",Il=({verbose:t},e)=>!["none","short"].includes(RR(t,e)),SZ=({verbose:t},e)=>{let r=RR(t,e);return ab(r)?r:void 0},RR=(t,e)=>e===void 0?wve(t):wo(t,e),wve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as xve}from"node:process";import{stripVTControlCharacters as $ve}from"node:util";var wZ,ep,xZ,kve,Eve,Ave,Tve,Ove,Rve,Ive,lb=y(()=>{wZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Rve(xZ(o))).join(" ");return{command:n,escapedCommand:i}},ep=t=>$ve(t).split(` +`).map(e=>xZ(e)).join(` +`),xZ=t=>t.replaceAll(Ave,e=>kve(e)),kve=t=>{let e=Tve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Ove?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Eve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ave=Eve(),Tve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Ove=65535,Rve=t=>Ive.test(t)?t:xve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Ive=/^[\w./-]+$/});import $Z from"node:process";function IR(){let{env:t}=$Z,{TERM:e,TERM_PROGRAM:r}=t;return $Z.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 kZ=y(()=>{});var EZ,AZ,Pve,Cve,Dve,Nve,jve,ub,Ttt,TZ=y(()=>{kZ();EZ={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"},AZ={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"},Pve={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"},Cve={...EZ,...AZ},Dve={...EZ,...Pve},Nve=IR(),jve=Nve?Cve:Dve,ub=jve,Ttt=Object.entries(AZ)});import Mve from"node:tty";var Fve,ve,Itt,OZ,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,Ltt,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,db,Vtt,Wtt,Ktt,Jtt,Ytt,Xtt,Qtt,ert,trt,RZ,rrt,IZ,nrt,irt,ort,srt,art,crt,lrt,urt,drt,frt,prt,PR=y(()=>{Fve=Mve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Fve)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}},Itt=ve(0,0),OZ=ve(1,22),Ptt=ve(2,22),Ctt=ve(3,23),Dtt=ve(4,24),Ntt=ve(53,55),jtt=ve(7,27),Mtt=ve(8,28),Ftt=ve(9,29),Ltt=ve(30,39),ztt=ve(31,39),Utt=ve(32,39),qtt=ve(33,39),Htt=ve(34,39),Btt=ve(35,39),Gtt=ve(36,39),Ztt=ve(37,39),db=ve(90,39),Vtt=ve(40,49),Wtt=ve(41,49),Ktt=ve(42,49),Jtt=ve(43,49),Ytt=ve(44,49),Xtt=ve(45,49),Qtt=ve(46,49),ert=ve(47,49),trt=ve(100,49),RZ=ve(91,39),rrt=ve(92,39),IZ=ve(93,39),nrt=ve(94,39),irt=ve(95,39),ort=ve(96,39),srt=ve(97,39),art=ve(101,49),crt=ve(102,49),lrt=ve(103,49),urt=ve(104,49),drt=ve(105,49),frt=ve(106,49),prt=ve(107,49)});var PZ=y(()=>{PR();PR()});var NZ,zve,fb,CZ,Uve,DZ,qve,jZ=y(()=>{TZ();PZ();NZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=zve(r),c=Uve[t]({failed:o,reject:s,piped:n}),l=qve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},zve=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"),CZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Uve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:CZ,duration:CZ},DZ=t=>t,qve={command:()=>OZ,output:()=>DZ,ipc:()=>DZ,error:({reject:t})=>t?RZ:IZ,duration:()=>db}});var MZ,Hve,Bve,FZ=y(()=>{ps();MZ=(t,e,r)=>{let n=SZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hve(i,o,n)).filter(i=>i!==void 0).map(i=>Bve(i)).join("")},Hve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Bve=t=>t.endsWith(` `)?t:`${t} -`});import{inspect as Mve}from"node:util";var Ci,Fve,Lve,zve,pb,Uve,Il=y(()=>{lb();NZ();MZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Fve({type:t,result:i,verboseInfo:n}),s=Lve(e,o),a=jZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Fve=({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}),Lve=(t,e)=>t.split(` -`).map(r=>zve({...e,message:r})),zve=t=>({verboseLine:DZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Mve(t);return Qf(e).replaceAll(" "," ".repeat(Uve))},Uve=2});var FZ,LZ=y(()=>{ps();Il();FZ=(t,e)=>{Ol(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var zZ,qve,Hve,Bve,UZ=y(()=>{ps();zZ=(t,e,r)=>{Bve(t);let n=qve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},qve=t=>Ol({verbose:t})?Hve++:void 0,Hve=0n,Bve=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 qZ}from"node:process";var mb,CR,hb=y(()=>{mb=()=>qZ.bigint(),CR=t=>Number(qZ.bigint()-t)/1e6});var gb,DR=y(()=>{LZ();UZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=SZ(t,e),s=AR(r,"verbose"),a=zZ(s,o,{...r});return FZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var VZ=v((Art,ZZ)=>{ZZ.exports=GZ;GZ.sync=Zve;var HZ=Ge("fs");function Gve(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{YZ.exports=KZ;KZ.sync=Vve;var WZ=Ge("fs");function KZ(t,e,r){WZ.stat(t,function(n,i){r(n,n?!1:JZ(i,e))})}function Vve(t,e){return JZ(WZ.statSync(t),e)}function JZ(t,e){return t.isFile()&&Wve(t,e)}function Wve(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 eV=v((Rrt,QZ)=>{var Ort=Ge("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=VZ():yb=XZ();QZ.exports=NR;NR.sync=Kve;function NR(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){NR(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 Kve(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var aV=v((Irt,sV)=>{var Pl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",tV=Ge("path"),Jve=Pl?";":":",rV=eV(),nV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),iV=(t,e)=>{let r=e.colon||Jve,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}},oV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=iV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(nV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=tV.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];rV(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)},Yve=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=iV(t,e),o=[];for(let s=0;s{"use strict";var cV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};jR.exports=cV;jR.exports.default=cV});var pV=v((Crt,fV)=>{"use strict";var uV=Ge("path"),Xve=aV(),Qve=lV();function dV(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=Xve.sync(t.command,{path:r[Qve({env:r})],pathExt:e?uV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=uV.resolve(i?t.options.cwd:"",s)),s}function eSe(t){return dV(t)||dV(t,!0)}fV.exports=eSe});var mV=v((Drt,FR)=>{"use strict";var MR=/([()\][%!^"`<>&|;, *?])/g;function tSe(t){return t=t.replace(MR,"^$1"),t}function rSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(MR,"^$1"),e&&(t=t.replace(MR,"^$1")),t}FR.exports.command=tSe;FR.exports.argument=rSe});var gV=v((Nrt,hV)=>{"use strict";hV.exports=/^#!(.*)/});var _V=v((jrt,yV)=>{"use strict";var nSe=gV();yV.exports=(t="")=>{let e=t.match(nSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var vV=v((Mrt,bV)=>{"use strict";var LR=Ge("fs"),iSe=_V();function oSe(t){let r=Buffer.alloc(150),n;try{n=LR.openSync(t,"r"),LR.readSync(n,r,0,150,0),LR.closeSync(n)}catch{}return iSe(r.toString())}bV.exports=oSe});var $V=v((Frt,xV)=>{"use strict";var sSe=Ge("path"),SV=pV(),wV=mV(),aSe=vV(),cSe=process.platform==="win32",lSe=/\.(?:com|exe)$/i,uSe=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function dSe(t){t.file=SV(t);let e=t.file&&aSe(t.file);return e?(t.args.unshift(t.file),t.command=e,SV(t)):t.file}function fSe(t){if(!cSe)return t;let e=dSe(t),r=!lSe.test(e);if(t.options.forceShell||r){let n=uSe.test(e);t.command=sSe.normalize(t.command),t.command=wV.command(t.command),t.args=t.args.map(o=>wV.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 pSe(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:fSe(n)}xV.exports=pSe});var AV=v((Lrt,EV)=>{"use strict";var zR=process.platform==="win32";function UR(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 mSe(t,e){if(!zR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=kV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function kV(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawn"):null}function hSe(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawnSync"):null}EV.exports={hookChildProcess:mSe,verifyENOENT:kV,verifyENOENTSync:hSe,notFoundError:UR}});var RV=v((zrt,Cl)=>{"use strict";var TV=Ge("child_process"),qR=$V(),HR=AV();function OV(t,e,r){let n=qR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return HR.hookChildProcess(i,n),i}function gSe(t,e,r){let n=qR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||HR.verifyENOENTSync(i.status,n),i}Cl.exports=OV;Cl.exports.spawn=OV;Cl.exports.sync=gSe;Cl.exports._parse=qR;Cl.exports._enoent=HR});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 IV=y(()=>{});var PV=y(()=>{});import{promisify as ySe}from"node:util";import{execFile as _Se,execFileSync as Grt}from"node:child_process";import CV from"node:path";import{fileURLToPath as bSe}from"node:url";function bb(t){return t instanceof URL?bSe(t):t}function DV(t){return{*[Symbol.iterator](){let e=CV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=CV.resolve(e,"..")}}}var Wrt,Krt,NV=y(()=>{PV();Wrt=ySe(_Se);Krt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var vSe,SSe,wSe,jV,MV=y(()=>{IV();NV();vSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&SSe(s,a,o),i&&wSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},SSe=(t,e,r)=>{for(let n of DV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},wSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},jV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=vSe(e),t}});var FV,ni,LV,zV,UV,Sb,ep,tp,Da=y(()=>{FV=(t,e,r)=>{let n=r?tp:ep,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},LV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,UV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},zV=t=>Sb(t)&&UV in t,UV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",ep=class extends Error{};LV(ep,ep.name);tp=class extends Error{};LV(tp,tp.name)});var qV,xSe,HV,BV,GV=y(()=>{qV=()=>{let t=BV-HV+1;return Array.from({length:t},xSe)},xSe=(t,e)=>({name:`SIGRT${e+1}`,number:HV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),HV=34,BV=64});var ZV,VV=y(()=>{ZV=[{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 BR,kSe,WV=y(()=>{VV();GV();BR=()=>{let t=qV();return[...ZV,...t].map(kSe)},kSe=({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 ESe}from"node:os";var ASe,TSe,KV,OSe,RSe,ISe,fnt,JV=y(()=>{WV();ASe=()=>{let t=BR();return Object.fromEntries(t.map(TSe))},TSe=({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}],KV=ASe(),OSe=()=>{let t=BR(),e=65,r=Array.from({length:e},(n,i)=>RSe(i,t));return Object.assign({},...r)},RSe=(t,e)=>{let r=ISe(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}}},ISe=(t,e)=>{let r=e.find(({name:n})=>ESe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},fnt=OSe()});import{constants as rp}from"node:os";var XV,QV,e9,PSe,CSe,YV,DSe,GR,NSe,jSe,wb,np=y(()=>{JV();XV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return e9(t,e)},QV=t=>t===0?t:e9(t,"`subprocess.kill()`'s argument"),e9=(t,e)=>{if(Number.isInteger(t))return PSe(t,e);if(typeof t=="string")return DSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${GR()}`)},PSe=(t,e)=>{if(YV.has(t))return YV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${GR()}`)},CSe=()=>new Map(Object.entries(rp.signals).reverse().map(([t,e])=>[e,t])),YV=CSe(),DSe=(t,e)=>{if(t in rp.signals)return t;throw t.toUpperCase()in rp.signals?new TypeError(`Invalid ${e} '${t}': please rename it to '${t.toUpperCase()}'.`):new TypeError(`Invalid ${e} '${t}': this signal name does not exist. -${GR()}`)},GR=()=>`Available signal names: ${NSe()}. -Available signal numbers: ${jSe()}.`,NSe=()=>Object.keys(rp.signals).sort().map(t=>`'${t}'`).join(", "),jSe=()=>[...new Set(Object.values(rp.signals).sort((t,e)=>t-e))].join(", "),wb=t=>KV[t].description});import{setTimeout as MSe}from"node:timers/promises";var t9,FSe,r9,LSe,zSe,USe,ZR,xb=y(()=>{Da();np();t9=t=>{if(t===!1)return t;if(t===!0)return FSe;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},FSe=1e3*5,r9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=LSe(s,a,r);zSe(l,n);let u=t(c);return USe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},LSe=(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:QV(n),error:i}},zSe=(t,e)=>{t!==void 0&&e.reject(t)},USe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&ZR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},ZR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await MSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as qSe}from"node:events";var $b,VR=y(()=>{$b=async(t,e)=>{t.aborted||await qSe(t,"abort",{signal:e})}});var n9,i9,HSe,WR=y(()=>{VR();n9=({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)}`)},i9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[HSe(t,e,n,i)],HSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Dl,BSe,KR,o9,s9,kb,a9,c9,l9,u9,d9,f9,GSe,ZSe,VSe,ii,WSe,ms,Nl,jl=y(()=>{Dl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{BSe(t,e,r),KR(t,e,n)},BSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},KR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},o9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},s9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. +`});import{inspect as Gve}from"node:util";var Ci,Zve,Vve,Wve,pb,Kve,Pl=y(()=>{lb();jZ();FZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Zve({type:t,result:i,verboseInfo:n}),s=Vve(e,o),a=MZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Zve=({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}),Vve=(t,e)=>t.split(` +`).map(r=>Wve({...e,message:r})),Wve=t=>({verboseLine:NZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Gve(t);return ep(e).replaceAll(" "," ".repeat(Kve))},Kve=2});var LZ,zZ=y(()=>{ps();Pl();LZ=(t,e)=>{Rl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var UZ,Jve,Yve,Xve,qZ=y(()=>{ps();UZ=(t,e,r)=>{Xve(t);let n=Jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Jve=t=>Rl({verbose:t})?Yve++:void 0,Yve=0n,Xve=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 HZ}from"node:process";var mb,CR,hb=y(()=>{mb=()=>HZ.bigint(),CR=t=>Number(HZ.bigint()-t)/1e6});var gb,DR=y(()=>{zZ();qZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=wZ(t,e),s=AR(r,"verbose"),a=UZ(s,o,{...r});return LZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var WZ=v((Lrt,VZ)=>{VZ.exports=ZZ;ZZ.sync=eSe;var BZ=Ze("fs");function Qve(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{XZ.exports=JZ;JZ.sync=tSe;var KZ=Ze("fs");function JZ(t,e,r){KZ.stat(t,function(n,i){r(n,n?!1:YZ(i,e))})}function tSe(t,e){return YZ(KZ.statSync(t),e)}function YZ(t,e){return t.isFile()&&rSe(t,e)}function rSe(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 tV=v((qrt,eV)=>{var Urt=Ze("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=WZ():yb=QZ();eV.exports=NR;NR.sync=nSe;function NR(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){NR(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 nSe(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var cV=v((Hrt,aV)=>{var Cl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rV=Ze("path"),iSe=Cl?";":":",nV=tV(),iV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),oV=(t,e)=>{let r=e.colon||iSe,n=t.match(/\//)||Cl&&t.match(/\\/)?[""]:[...Cl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Cl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Cl?i.split(r):[""];return Cl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},sV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=oV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(iV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=rV.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];nV(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)},oSe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=oV(t,e),o=[];for(let s=0;s{"use strict";var lV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};jR.exports=lV;jR.exports.default=lV});var mV=v((Grt,pV)=>{"use strict";var dV=Ze("path"),sSe=cV(),aSe=uV();function fV(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=sSe.sync(t.command,{path:r[aSe({env:r})],pathExt:e?dV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=dV.resolve(i?t.options.cwd:"",s)),s}function cSe(t){return fV(t)||fV(t,!0)}pV.exports=cSe});var hV=v((Zrt,FR)=>{"use strict";var MR=/([()\][%!^"`<>&|;, *?])/g;function lSe(t){return t=t.replace(MR,"^$1"),t}function uSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(MR,"^$1"),e&&(t=t.replace(MR,"^$1")),t}FR.exports.command=lSe;FR.exports.argument=uSe});var yV=v((Vrt,gV)=>{"use strict";gV.exports=/^#!(.*)/});var bV=v((Wrt,_V)=>{"use strict";var dSe=yV();_V.exports=(t="")=>{let e=t.match(dSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var SV=v((Krt,vV)=>{"use strict";var LR=Ze("fs"),fSe=bV();function pSe(t){let r=Buffer.alloc(150),n;try{n=LR.openSync(t,"r"),LR.readSync(n,r,0,150,0),LR.closeSync(n)}catch{}return fSe(r.toString())}vV.exports=pSe});var kV=v((Jrt,$V)=>{"use strict";var mSe=Ze("path"),wV=mV(),xV=hV(),hSe=SV(),gSe=process.platform==="win32",ySe=/\.(?:com|exe)$/i,_Se=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bSe(t){t.file=wV(t);let e=t.file&&hSe(t.file);return e?(t.args.unshift(t.file),t.command=e,wV(t)):t.file}function vSe(t){if(!gSe)return t;let e=bSe(t),r=!ySe.test(e);if(t.options.forceShell||r){let n=_Se.test(e);t.command=mSe.normalize(t.command),t.command=xV.command(t.command),t.args=t.args.map(o=>xV.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 SSe(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:vSe(n)}$V.exports=SSe});var TV=v((Yrt,AV)=>{"use strict";var zR=process.platform==="win32";function UR(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 wSe(t,e){if(!zR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=EV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function EV(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawn"):null}function xSe(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawnSync"):null}AV.exports={hookChildProcess:wSe,verifyENOENT:EV,verifyENOENTSync:xSe,notFoundError:UR}});var IV=v((Xrt,Dl)=>{"use strict";var OV=Ze("child_process"),qR=kV(),HR=TV();function RV(t,e,r){let n=qR(t,e,r),i=OV.spawn(n.command,n.args,n.options);return HR.hookChildProcess(i,n),i}function $Se(t,e,r){let n=qR(t,e,r),i=OV.spawnSync(n.command,n.args,n.options);return i.error=i.error||HR.verifyENOENTSync(i.status,n),i}Dl.exports=RV;Dl.exports.spawn=RV;Dl.exports.sync=$Se;Dl.exports._parse=qR;Dl.exports._enoent=HR});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 PV=y(()=>{});var CV=y(()=>{});import{promisify as kSe}from"node:util";import{execFile as ESe,execFileSync as nnt}from"node:child_process";import DV from"node:path";import{fileURLToPath as ASe}from"node:url";function bb(t){return t instanceof URL?ASe(t):t}function NV(t){return{*[Symbol.iterator](){let e=DV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=DV.resolve(e,"..")}}}var snt,ant,jV=y(()=>{CV();snt=kSe(ESe);ant=10*1024*1024});import vb from"node:process";import Ca from"node:path";var TSe,OSe,RSe,MV,FV=y(()=>{PV();jV();TSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&OSe(s,a,o),i&&RSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},OSe=(t,e,r)=>{for(let n of NV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},RSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},MV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=TSe(e),t}});var LV,ni,zV,UV,qV,Sb,tp,rp,Da=y(()=>{LV=(t,e,r)=>{let n=r?rp:tp,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},zV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,qV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},UV=t=>Sb(t)&&qV in t,qV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",tp=class extends Error{};zV(tp,tp.name);rp=class extends Error{};zV(rp,rp.name)});var HV,ISe,BV,GV,ZV=y(()=>{HV=()=>{let t=GV-BV+1;return Array.from({length:t},ISe)},ISe=(t,e)=>({name:`SIGRT${e+1}`,number:BV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BV=34,GV=64});var VV,WV=y(()=>{VV=[{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 PSe}from"node:os";var BR,CSe,KV=y(()=>{WV();ZV();BR=()=>{let t=HV();return[...VV,...t].map(CSe)},CSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=PSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as DSe}from"node:os";var NSe,jSe,JV,MSe,FSe,LSe,$nt,YV=y(()=>{KV();NSe=()=>{let t=BR();return Object.fromEntries(t.map(jSe))},jSe=({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}],JV=NSe(),MSe=()=>{let t=BR(),e=65,r=Array.from({length:e},(n,i)=>FSe(i,t));return Object.assign({},...r)},FSe=(t,e)=>{let r=LSe(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}}},LSe=(t,e)=>{let r=e.find(({name:n})=>DSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},$nt=MSe()});import{constants as np}from"node:os";var QV,e9,t9,zSe,USe,XV,qSe,GR,HSe,BSe,wb,ip=y(()=>{YV();QV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return t9(t,e)},e9=t=>t===0?t:t9(t,"`subprocess.kill()`'s argument"),t9=(t,e)=>{if(Number.isInteger(t))return zSe(t,e);if(typeof t=="string")return qSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${GR()}`)},zSe=(t,e)=>{if(XV.has(t))return XV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${GR()}`)},USe=()=>new Map(Object.entries(np.signals).reverse().map(([t,e])=>[e,t])),XV=USe(),qSe=(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. +${GR()}`)},GR=()=>`Available signal names: ${HSe()}. +Available signal numbers: ${BSe()}.`,HSe=()=>Object.keys(np.signals).sort().map(t=>`'${t}'`).join(", "),BSe=()=>[...new Set(Object.values(np.signals).sort((t,e)=>t-e))].join(", "),wb=t=>JV[t].description});import{setTimeout as GSe}from"node:timers/promises";var r9,ZSe,n9,VSe,WSe,KSe,ZR,xb=y(()=>{Da();ip();r9=t=>{if(t===!1)return t;if(t===!0)return ZSe;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},ZSe=1e3*5,n9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=VSe(s,a,r);WSe(l,n);let u=t(c);return KSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},VSe=(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:e9(n),error:i}},WSe=(t,e)=>{t!==void 0&&e.reject(t)},KSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&ZR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},ZR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await GSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as JSe}from"node:events";var $b,VR=y(()=>{$b=async(t,e)=>{t.aborted||await JSe(t,"abort",{signal:e})}});var i9,o9,YSe,WR=y(()=>{VR();i9=({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)}`)},o9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[YSe(t,e,n,i)],YSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Nl,XSe,KR,s9,a9,kb,c9,l9,u9,d9,f9,p9,QSe,ewe,twe,ii,rwe,ms,jl,Ml=y(()=>{Nl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{XSe(t,e,r),KR(t,e,n)},XSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},KR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},s9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},a9=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}")}, -]);`)},kb=(t,e)=>new Error(`${ii("sendMessage",e)} failed when sending an acknowledgment response to the ${ms(e)}.`,{cause:t}),a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},l9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),u9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},d9=({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})},f9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(GSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},GSe=({code:t,message:e})=>ZSe.has(t)||VSe.some(r=>e.includes(r)),ZSe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),VSe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${WSe(e)}${t}(${r})`,WSe=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,p9,KSe,JSe,m9,YSe,h9,ip,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(m9(o,e,n,!0));return s},Fl=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=p9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(m9(o,e,n,!1));return s},Ni=new WeakMap,p9=(t,e,r)=>{let n=KSe(e,r);return JSe(n,e,r,t),n},KSe=(t,e)=>{let r=TR(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(`"${ip(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}),c9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is not listening to incoming messages.`)},l9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} exited without listening to incoming messages.`)},u9=()=>new Error(`\`cancelSignal\` aborted: the ${ms(!0)} disconnected.`),d9=()=>{throw new Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},f9=({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})},p9=({error:t,methodName:e,isSubprocess:r,message:n})=>{if(QSe(t))throw new Error(`${ii(e,r)}'s argument type is invalid: the message cannot be serialized: ${String(n)}.`,{cause:t})},QSe=({code:t,message:e})=>ewe.has(t)||twe.some(r=>e.includes(r)),ewe=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),twe=["could not be cloned","circular structure","call stack size exceeded"],ii=(t,e,r="")=>t==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${rwe(e)}${t}(${r})`,rwe=t=>t?"":"subprocess.",ms=t=>t?"parent process":"subprocess",jl=t=>{t.connected&&t.disconnect()}});var Di,Fl=y(()=>{Di=()=>{let t={},e=new Promise((r,n)=>{Object.assign(t,{resolve:r,reject:n})});return Object.assign(e,t)}});var Ab,Ll,Ni,m9,nwe,iwe,h9,owe,g9,op,Eb,hs=y(()=>{xo();Ab=(t,e="stdin")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=m9(i,e,!0),s=t.stdio[o];if(s===null)throw new TypeError(h9(o,e,n,!0));return s},Ll=(t,e="stdout")=>{let{options:n,fileDescriptors:i}=Ni.get(t),o=m9(i,e,!1),s=o==="all"?t.all:t.stdio[o];if(s==null)throw new TypeError(h9(o,e,n,!1));return s},Ni=new WeakMap,m9=(t,e,r)=>{let n=nwe(e,r);return iwe(n,e,r,t),n},nwe=(t,e)=>{let r=TR(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}".`)},JSe=(t,e,r,n)=>{let i=n[h9(t)];if(i===void 0)throw new TypeError(`"${ip(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(`"${ip(r)}" must not be ${e}. It must be a readable stream, not writable.`);if(i.direction!=="input"&&r)throw new TypeError(`"${ip(r)}" must not be ${e}. It must be a writable stream, not readable.`)},m9=(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}=YSe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${ip(n)}: ${Eb(e)}". -Please set this option with "pipe" instead.`},YSe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=h9(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]}},h9=t=>t==="all"?1:t,ip=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as XSe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),XSe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,JR,Rb,YR,g9,y9,op=y(()=>{Ob=(t,e)=>{e&&JR(t)},JR=t=>{t.refCounted()},Rb=(t,e)=>{e&&YR(t)},YR=t=>{t.unrefCounted()},g9=(t,e)=>{e&&(YR(t),YR(t))},y9=(t,e)=>{e&&(JR(t),JR(t))}});import{once as QSe}from"node:events";import{scheduler as ewe}from"node:timers/promises";var _9,b9,Ib,v9=y(()=>{Cb();op();Pb();Db();_9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(w9(i)||$9(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 x9(t,n,i),await ewe.yield();let s=await S9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{XR();let o=Ib.get(t);for(;o?.length>0;)await QSe(n,"message:done");t.removeListener("message",i),y9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as twe}from"node:events";var gs,Nb,rwe,jb,sp=y(()=>{v9();op();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new twe;return n.connected=!0,Nb.set(t,n),rwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,rwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=_9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),g9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as nwe}from"node:events";var k9,iwe,E9,S9,w9,A9,Mb,owe,Fb,T9,Pb=y(()=>{Ml();Tb();Ub();jl();sp();Cb();k9=({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:iwe++,type:Fb,message:n,hasListeners:s}},iwe=0n,E9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},S9=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:T9,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},w9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},A9=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,owe(e,r,i)]);o&&s9(r),s||a9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},owe=async(t,e,{signal:r})=>{Na(t,1,r),await nwe(t,"disconnect",{signal:r}),c9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var O9,R9,x9,ap,Lb,swe,Cb=y(()=>{Ml();xo();hs();Pb();O9=(t,e,r)=>{ap.has(t)||ap.set(t,new Set);let n=ap.get(t),i=Di(),o=r?e.id:void 0,s={onMessageSent:i,id:o};return n.add(s),{outgoingMessages:n,outgoingMessage:s}},R9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},x9=async(t,e,r)=>{for(;!Lb(t,e)&&ap.get(t)?.size>0;){let n=[...ap.get(t)];E9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},ap=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>swe(t),swe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as awe}from"node:util";var zb,cwe,eI,lwe,QR,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}),cwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},cwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=k9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=O9(t,s,o);try{await eI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw Nl(t),c}finally{R9(a)}},eI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=lwe(t);try{await Promise.all([A9(n,t,r),o(n)])}catch(s){throw d9({error:s,methodName:e,isSubprocess:r}),f9({error:s,methodName:e,isSubprocess:r,message:i}),s}},lwe=t=>{if(QR.has(t))return QR.get(t);let e=awe(t.send.bind(t));return QR.set(t,e),e},QR=new WeakMap});import{scheduler as uwe}from"node:timers/promises";var P9,C9,dwe,I9,$9,D9,XR,tI,Db=y(()=>{Ub();sp();jl();P9=(t,e)=>{let r="cancelSignal";return KR(r,!1,t.connected),eI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:D9,message:e},message:e})},C9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await dwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),tI.signal),dwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!I9){if(I9=!0,!n){u9();return}if(e===null){XR();return}gs(t,e,r),await uwe.yield()}},I9=!1,$9=t=>t?.type!==D9?!1:(tI.abort(t.message),!0),D9="execa:ipc:cancel",XR=()=>{tI.abort(l9())},tI=new AbortController});var N9,j9,fwe,pwe,rI=y(()=>{VR();Db();xb();N9=({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.")}},j9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[fwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],fwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=pwe(e);throw await P9(t,o),ZR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},pwe=({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 mwe}from"node:timers/promises";var M9,F9,hwe,nI=y(()=>{Da();M9=({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})`)},F9=(t,e,r,n)=>e===0||e===void 0?[]:[hwe(t,e,r,n)],hwe=async(t,e,r,{signal:n})=>{throw await mwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as gwe,execArgv as ywe}from"node:process";import L9 from"node:path";var z9,U9,iI=y(()=>{Tl();z9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},U9=(t,e,{node:r=!1,nodePath:n=gwe,nodeOptions:i=ywe.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=L9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(L9.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 _we}from"node:v8";var q9,bwe,vwe,Swe,H9,oI=y(()=>{q9=({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`.");Swe[r](t)}},bwe=t=>{try{_we(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},vwe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Swe={advanced:bwe,json:vwe},H9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var G9,wwe,cn,sI,xwe,B9,qb,ja=y(()=>{G9=({encoding:t})=>{if(sI.has(t))return;let e=xwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +It is optional and defaults to "${i}".`)},iwe=(t,e,r,n)=>{let i=n[g9(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.`)},h9=(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}=owe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${op(n)}: ${Eb(e)}". +Please set this option with "pipe" instead.`},owe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=g9(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]}},g9=t=>t==="all"?1:t,op=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as swe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),swe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,JR,Rb,YR,y9,_9,sp=y(()=>{Ob=(t,e)=>{e&&JR(t)},JR=t=>{t.refCounted()},Rb=(t,e)=>{e&&YR(t)},YR=t=>{t.unrefCounted()},y9=(t,e)=>{e&&(YR(t),YR(t))},_9=(t,e)=>{e&&(JR(t),JR(t))}});import{once as awe}from"node:events";import{scheduler as cwe}from"node:timers/promises";var b9,v9,Ib,S9=y(()=>{Cb();sp();Pb();Db();b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(x9(i)||k9(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 $9(t,n,i),await cwe.yield();let s=await w9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{XR();let o=Ib.get(t);for(;o?.length>0;)await awe(n,"message:done");t.removeListener("message",i),_9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as lwe}from"node:events";var gs,Nb,uwe,jb,ap=y(()=>{S9();sp();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new lwe;return n.connected=!0,Nb.set(t,n),uwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,uwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),y9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dwe}from"node:events";var E9,fwe,A9,w9,x9,T9,Mb,pwe,Fb,O9,Pb=y(()=>{Fl();Tb();Ub();Ml();ap();Cb();E9=({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:fwe++,type:Fb,message:n,hasListeners:s}},fwe=0n,A9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},w9=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:O9,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},x9=t=>{if(t?.type!==O9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},T9=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,pwe(e,r,i)]);o&&a9(r),s||c9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},pwe=async(t,e,{signal:r})=>{Na(t,1,r),await dwe(t,"disconnect",{signal:r}),l9(e)},Fb="execa:ipc:request",O9="execa:ipc:response"});var R9,I9,$9,cp,Lb,mwe,Cb=y(()=>{Fl();xo();hs();Pb();R9=(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}},I9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},$9=async(t,e,r)=>{for(;!Lb(t,e)&&cp.get(t)?.size>0;){let n=[...cp.get(t)];A9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},cp=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>mwe(t),mwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as hwe}from"node:util";var zb,gwe,eI,ywe,QR,Ub=y(()=>{Ml();Cb();Pb();zb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Nl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=E9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=R9(t,s,o);try{await eI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw jl(t),c}finally{I9(a)}},eI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ywe(t);try{await Promise.all([T9(n,t,r),o(n)])}catch(s){throw f9({error:s,methodName:e,isSubprocess:r}),p9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ywe=t=>{if(QR.has(t))return QR.get(t);let e=hwe(t.send.bind(t));return QR.set(t,e),e},QR=new WeakMap});import{scheduler as _we}from"node:timers/promises";var C9,D9,bwe,P9,k9,N9,XR,tI,Db=y(()=>{Ub();ap();Ml();C9=(t,e)=>{let r="cancelSignal";return KR(r,!1,t.connected),eI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:N9,message:e},message:e})},D9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),tI.signal),bwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!P9){if(P9=!0,!n){d9();return}if(e===null){XR();return}gs(t,e,r),await _we.yield()}},P9=!1,k9=t=>t?.type!==N9?!1:(tI.abort(t.message),!0),N9="execa:ipc:cancel",XR=()=>{tI.abort(u9())},tI=new AbortController});var j9,M9,vwe,Swe,rI=y(()=>{VR();Db();xb();j9=({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.")}},M9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=Swe(e);throw await C9(t,o),ZR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Swe=({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 wwe}from"node:timers/promises";var F9,L9,xwe,nI=y(()=>{Da();F9=({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})`)},L9=(t,e,r,n)=>e===0||e===void 0?[]:[xwe(t,e,r,n)],xwe=async(t,e,r,{signal:n})=>{throw await wwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as $we,execArgv as kwe}from"node:process";import z9 from"node:path";var U9,q9,iI=y(()=>{Ol();U9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},q9=(t,e,{node:r=!1,nodePath:n=$we,nodeOptions:i=kwe.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=Tl(n,'The "nodePath" option'),l=z9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(z9.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 Ewe}from"node:v8";var H9,Awe,Twe,Owe,B9,oI=y(()=>{H9=({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`.");Owe[r](t)}},Awe=t=>{try{Ewe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Twe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Owe={advanced:Awe,json:Twe},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var Z9,Rwe,cn,sI,Iwe,G9,qb,ja=y(()=>{Z9=({encoding:t})=>{if(sI.has(t))return;let e=Iwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. Please rename it to ${qb(e)}.`);let r=[...sI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to one of: ${r}.`)},wwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),sI=new Set([...wwe,...cn]),xwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in B9)return B9[e];if(sI.has(e))return e},B9={"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 kwe from"node:path";import Ewe from"node:process";var Z9,V9,W9,aI=y(()=>{Tl();Z9=(t=V9())=>{let e=Al(t,'The "cwd" option');return kwe.resolve(e)},V9=()=>{try{return Ewe.cwd()}catch(t){throw t.message=`The current directory does not exist. -${t.message}`,t}},W9=(t,e)=>{if(e===V9())return t;let r;try{r=$we(e)}catch(n){return`The "cwd" option is invalid: ${e}. +Please rename it to one of: ${r}.`)},Rwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),sI=new Set([...Rwe,...cn]),Iwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in G9)return G9[e];if(sI.has(e))return e},G9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pwe}from"node:fs";import Cwe from"node:path";import Dwe from"node:process";var V9,W9,K9,aI=y(()=>{Ol();V9=(t=W9())=>{let e=Tl(t,'The "cwd" option');return Cwe.resolve(e)},W9=()=>{try{return Dwe.cwd()}catch(t){throw t.message=`The current directory does not exist. +${t.message}`,t}},K9=(t,e)=>{if(e===W9())return t;let r;try{r=Pwe(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 Awe from"node:path";import K9 from"node:process";var J9,Hb,Twe,Owe,cI=y(()=>{J9=wt(RV(),1);MV();xb();np();WR();rI();nI();iI();oI();ja();aI();Tl();xo();Hb=(t,e,r)=>{r.cwd=Z9(r.cwd);let[n,i,o]=U9(t,e,r),{command:s,args:a,options:c}=J9.default._parse(n,i,o),l=bZ(c),u=Twe(l);return M9(u),G9(u),q9(u),n9(u),N9(u),u.shell=xR(u.shell),u.env=Owe(u),u.killSignal=XV(u.killSignal),u.forceKillAfterDelay=t9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),K9.platform==="win32"&&Awe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},Twe=({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}),Owe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...K9.env,...t}:t;return r||n?jV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,lI=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 Rwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Iwe(t)}var Rwe,Iwe,Y9,Pwe,X9,Cwe,uI=y(()=>{Rwe=t=>t.at(-1)===Y9?t.slice(0,t.at(-2)===X9?-2:-1):t,Iwe=t=>t.at(-1)===Pwe?t.subarray(0,t.at(-2)===Cwe?-2:-1):t,Y9=` -`,Pwe=Y9.codePointAt(0),X9="\r",Cwe=X9.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 dI(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 fI(t,e){return dI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function Q9(){return this[mI].next()}function eW(t){return this[mI].return(t)}function hI({preventCancel:t=!1}={}){let e=this.getReader(),r=new pI(e,t),n=Object.create(Nwe);return n[mI]=r,n}var Dwe,pI,mI,Nwe,tW=y(()=>{Dwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),pI=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}}},mI=Symbol();Object.defineProperty(Q9,"name",{value:"next"});Object.defineProperty(eW,"name",{value:"return"});Nwe=Object.create(Dwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:Q9},return:{enumerable:!0,configurable:!0,writable:!0,value:eW}})});var rW=y(()=>{});var nW=y(()=>{tW();rW()});var iW,jwe,Mwe,Fwe,cp,gI=y(()=>{Fa();nW();iW=t=>{if(Ma(t,{checkOpen:!1})&&cp.on!==void 0)return Mwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(jwe.call(t)==="[object ReadableStream]")return hI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:jwe}=Object.prototype,Mwe=async function*(t){let e=new AbortController,r={};Fwe(t,e,r);try{for await(let[n]of cp.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()}},Fwe=async(t,e,r)=>{try{await cp.finished(t,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(n){r.error=n}finally{e.abort()}},cp={}});var zl,Lwe,aW,oW,zwe,sW,ji,lp=y(()=>{gI();zl=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=iW(t),u=e();u.length=0;try{for await(let d of l){let f=zwe(d),p=r[f](d,u);aW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Lwe({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}},Lwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&aW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},aW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){oW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&oW(c,e,i,o),new ji},oW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},zwe=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=sW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&sW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:sW}=Object.prototype,ji=class extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var $o,up,Gb,Zb,Vb,Wb=y(()=>{$o=t=>t,up=()=>{},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,Bwe,e)}var Uwe,qwe,Hwe,Bwe,cW=y(()=>{lp();Wb();Uwe=()=>({contents:[]}),qwe=()=>1,Hwe=(t,{contents:e})=>(e.push(t),e),Bwe={init:Uwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:qwe,truncateChunk:up,addChunk:Hwe,getFinalChunk:up,finalize:Gb}});async function Jb(t,e){return zl(t,Qwe,e)}var Gwe,Zwe,Vwe,lW,uW,Wwe,Kwe,Jwe,Ywe,fW,dW,Xwe,pW,Qwe,mW=y(()=>{lp();Wb();Gwe=()=>({contents:new ArrayBuffer(0)}),Zwe=t=>Vwe.encode(t),Vwe=new TextEncoder,lW=t=>new Uint8Array(t),uW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),Wwe=(t,e)=>t.slice(0,e),Kwe=(t,{contents:e,length:r},n)=>{let i=pW()?Ywe(e,n):Jwe(e,n);return new Uint8Array(i).set(t,r),i},Jwe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(fW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},Ywe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:fW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},fW=t=>dW**Math.ceil(Math.log(t)/Math.log(dW)),dW=2,Xwe=({contents:t,length:e})=>pW()?t:t.slice(0,e),pW=()=>"resize"in ArrayBuffer.prototype,Qwe={init:Gwe,convertChunk:{string:Zwe,buffer:lW,arrayBuffer:lW,dataView:uW,typedArray:uW,others:Zb},getSize:Vb,truncateChunk:Wwe,addChunk:Kwe,getFinalChunk:up,finalize:Xwe}});async function Xb(t,e){return zl(t,ixe,e)}var exe,Yb,txe,rxe,nxe,ixe,hW=y(()=>{lp();Wb();exe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),txe=(t,{contents:e})=>e+t,rxe=(t,e)=>t.slice(0,e),nxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},ixe={init:exe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:txe,getFinalChunk:nxe,finalize:Gb}});var gW=y(()=>{cW();mW();hW();lp()});import{on as oxe}from"node:events";import{finished as sxe}from"node:stream/promises";var Qb=y(()=>{gI();gW();Object.assign(cp,{on:oxe,finished:sxe})});var yW,axe,_W,bW,cxe,vW,SW,ev,La=y(()=>{Qb();So();xo();yW=({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=axe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},axe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",_W=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},bW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=cxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},cxe=(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}},vW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),SW=(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 lxe}from"node:util";var xW,uxe,dxe,fxe,pxe,mxe,wW,$W=y(()=>{uI();an();aI();lb();La();np();Da();xW=({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=uxe({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=fxe(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=>pxe(D)).join(` -`)].map(D=>Qf(Ll(mxe(D)))).filter(Boolean).join(` - -`);return{originalMessage:x,shortMessage:R,message:T}},uxe=({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=dxe(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?`${bW(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"},dxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",fxe=(t,e)=>{if(t instanceof ni)return;let r=zV(t)?t.originalMessage:String(t?.message??t),n=Qf(W9(r,e));return n===""?void 0:n},pxe=t=>typeof t=="string"?t:lxe(t),mxe=t=>Array.isArray(t)?t.map(e=>Ll(wW(e))).filter(Boolean).join(` -`):wW(t),wW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,Ul,dp,hxe,kW,gxe,fp=y(()=>{np();hb();Da();$W();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>kW({command:t,escapedCommand:e,cwd:o,durationMs:CR(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})=>dp({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}),dp=({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}=gxe(l,u),{originalMessage:T,shortMessage:D,message:E}=xW({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=FV(t,E,x);return Object.assign(ae,hxe({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},hxe=({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})=>kW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:CR(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:[]}),kW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),gxe=(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 yxe(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(EW(t*1e3)%1e3),nanoseconds:Math.trunc(EW(t*1e6)%1e3)}}function _xe(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 yI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return yxe(t);break}case"bigint":return _xe(t)}throw new TypeError("Expected a finite number or bigint")}var EW,AW=y(()=>{EW=t=>Number.isFinite(t)?t:0});function _I(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+Sxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&bxe(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?" "+vxe(d,u):f;i.push(p)}},a=yI(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%wxe):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 bxe,vxe,Sxe,wxe,TW=y(()=>{AW();bxe=t=>t===0||t===0n,vxe=(t,e)=>e===1||e===1n?t:`${t}s`,Sxe=1e-7,wxe=24n*60n*60n*1000n});var OW,RW=y(()=>{Il();OW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var IW,xxe,PW=y(()=>{TW();ps();Il();RW();IW=(t,e)=>{Ol(e)&&(OW(t,e),xxe(t,e))},xxe=(t,e)=>{let r=`(done in ${_I(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var ql,rv=y(()=>{PW();ql=(t,e,{reject:r})=>{if(IW(t,e),t.failed&&r)throw t;return t}});var NW,$xe,kxe,jW,MW,CW,Exe,bI,DW,za,FW,Axe,nv,LW,Txe,Oxe,vI,zW,Rxe,UW,iv,Ixe,SI,Pxe,Cxe,qW,Cn,ov,wI,HW,BW,ys,$r=y(()=>{Fa();bo();an();NW=(t,e)=>za(t)?"asyncGenerator":FW(t)?"generator":nv(t)?"fileUrl":Txe(t)?"filePath":Ixe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":Pxe(t)?"asyncIterable":Cxe(t)?"iterable":SI(t)?jW({transform:t},e):Axe(t)?$xe(t,e):"native",$xe=(t,e)=>fI(t.transform,{checkOpen:!1})?kxe(t,e):SI(t.transform)?jW(t,e):Exe(t,e),kxe=(t,e)=>(MW(t,e,"Duplex stream"),"duplex"),jW=(t,e)=>(MW(t,e,"web TransformStream"),"webTransform"),MW=({final:t,binary:e,objectMode:r},n,i)=>{CW(t,`${n}.final`,i),CW(e,`${n}.binary`,i),bI(r,`${n}.objectMode`)},CW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Exe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!DW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(fI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(SI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!DW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return bI(r,`${i}.binary`),bI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},bI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},DW=t=>za(t)||FW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",FW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Axe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",LW=t=>nv(t)&&t.protocol!=="file:",Txe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Oxe.has(e))&&vI(t.file),Oxe=new Set(["file","append"]),vI=t=>typeof t=="string",zW=(t,e)=>t==="native"&&typeof e=="string"&&!Rxe.has(e),Rxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),UW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Ixe=t=>UW(t)||iv(t),SI=t=>UW(t?.readable)&&iv(t?.writable),Pxe=t=>qW(t)&&typeof t[Symbol.asyncIterator]=="function",Cxe=t=>qW(t)&&typeof t[Symbol.iterator]=="function",qW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),wI=new Set(["fileUrl","filePath"]),HW=new Set([...wI,"webStream","nodeStream"]),BW=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 xI,Dxe,Nxe,GW,$I=y(()=>{$r();xI=(t,e,r,n)=>n==="output"?Dxe(t,e,r):Nxe(t,e,r),Dxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Nxe=(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}},GW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var ZW,jxe,Mxe,Fxe,Lxe,zxe,Uxe,VW=y(()=>{bo();ja();$r();$I();ZW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...jxe(t,e,r,n)],jxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Mxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Uxe(o,r)},Mxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Fxe({stdioItem:t,optionName:i}):e==="webTransform"?Lxe({stdioItem:t,index:r,newTransforms:n,direction:o}):zxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Fxe=({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}}},Lxe=({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}=xI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},zxe=({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}=xI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Uxe=(t,e)=>e==="input"?t.reverse():t});import kI from"node:process";var WW,qxe,Hxe,Hl,EI,KW,Bxe,Gxe,JW=y(()=>{Fa();$r();WW=(t,e,r)=>{let n=t.map(i=>qxe(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)??Gxe},qxe=({type:t,value:e},r)=>Hxe[r]??KW[t](e),Hxe=["input","output","output"],Hl=()=>{},EI=()=>"input",KW={generator:Hl,asyncGenerator:Hl,fileUrl:Hl,filePath:Hl,iterable:EI,asyncIterable:EI,uint8Array:EI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?dI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Hl,duplex:Hl,native(t){let e=Bxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return KW.nodeStream(t)}},Bxe=t=>{if([0,kI.stdin].includes(t))return"input";if([1,2,kI.stdout,kI.stderr].includes(t))return"output"},Gxe="output"});var YW,XW=y(()=>{YW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var QW,Zxe,Vxe,eK,Wxe,Kxe,tK=y(()=>{So();XW();ps();QW=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=Zxe(t,n).map((a,c)=>eK(a,c));return o?Wxe(s,r,i):YW(s,e)},Zxe=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(Vxe(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},Vxe=t=>Pn.some(e=>t[e]!==void 0),eK=(t,e)=>Array.isArray(t)?t.map(r=>eK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),Wxe=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Rl(r,i)&&Kxe(n)?"ignore":n),Kxe=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as Jxe}from"node:fs";import Yxe from"node:tty";var nK,Xxe,Qxe,e0e,t0e,rK,iK=y(()=>{Fa();So();an();hs();nK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?Xxe({stdioItem:t,fdNumber:n,direction:i}):t0e({stdioItem:t,fdNumber:n}),Xxe=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=Qxe({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},Qxe=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=e0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(Yxe.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(Jxe(i)),optionName:e}}},e0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},t0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:rK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:rK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,rK=(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 oK,r0e,n0e,i0e,o0e,sK=y(()=>{Fa();an();$r();oK=({input:t,inputFile:e},r)=>r===0?[...r0e(t),...i0e(e)]:[],r0e=t=>t===void 0?[]:[{type:n0e(t),value:t,optionName:"input"}],n0e=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.")},i0e=t=>t===void 0?[]:[{...o0e(t),optionName:"inputFile"}],o0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(vI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var aK,cK,s0e,a0e,lK,c0e,l0e,uK,dK=y(()=>{$r();aK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),cK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=s0e(i,t);if(s.length!==0){if(o){a0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(HW.has(t))return lK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});BW.has(t)&&l0e({otherStdioItems:s,type:t,value:e,optionName:r})}},s0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),a0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{wI.has(e)&&lK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},lK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>c0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return uK(s,n,e),i==="output"?o[0].stream:void 0},c0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,l0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);uK(i,n,e)},uK=(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,u0e,d0e,f0e,p0e,m0e,h0e,g0e,y0e,_0e,b0e,v0e,AI,S0e,av=y(()=>{So();VW();$I();$r();JW();tK();iK();sK();dK();sv=(t,e,r,n)=>{let o=QW(e,r,n).map((a,c)=>u0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=_0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>S0e(a)),s},u0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=d0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=WW(o,e,i),c=o.map(d=>nK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=ZW(c,i,a,r),u=GW(l,a);return y0e(l,u),{direction:a,objectMode:u,stdioItems:l}},d0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>f0e(c,n)),...oK(r,e)],s=aK(o),a=s.length>1;return p0e(s,a,n),h0e(s),{stdioItems:s,isStdioArray:a}},f0e=(t,e)=>({type:NW(t,e),value:t,optionName:e}),p0e=(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(m0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},m0e=new Set(["ignore","ipc"]),h0e=t=>{for(let e of t)g0e(e)},g0e=({type:t,value:e,optionName:r})=>{if(LW(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(zW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},y0e=(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.`)},_0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(b0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw AI(i),o}},b0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>v0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},v0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=cK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},AI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},S0e=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 fK}from"node:fs";var mK,Mi,w0e,hK,pK,x0e,gK=y(()=>{an();av();$r();mK=(t,e)=>sv(x0e,t,e,!0),Mi=({type:t,optionName:e})=>{hK(e,ys[t])},w0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&hK(t,`"${e}"`),{}),hK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},pK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:w0e},x0e={input:{...pK,fileUrl:({value:t})=>({contents:[vo(fK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(fK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...pK,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,TI,pp=y(()=>{uI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?Ll(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,RI,yK,_K,$0e,k0e,E0e,bK,A0e,OI,T0e,O0e,R0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:_K(e,n),RI=(t,e,r)=>r?t.flatMap(n=>yK(n,e)):yK(t,e),yK=(t,e)=>{let{transform:r,final:n}=_K(e,{});return[...r(t),...n()]},_K=(t,e)=>(e.previousChunks="",{transform:$0e.bind(void 0,e,t),final:E0e.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=OI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=OI(n,r.slice(i+1))),t.previousChunks=n},k0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),E0e=function*({previousChunks:t}){t.length>0&&(yield t)},bK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:A0e.bind(void 0,n)},A0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?T0e:R0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},OI=(t,e)=>`${t}${e}`,T0e={windowsNewline:`\r +${t}`}});import Nwe from"node:path";import J9 from"node:process";var Y9,Hb,jwe,Mwe,cI=y(()=>{Y9=wt(IV(),1);FV();xb();ip();WR();rI();nI();iI();oI();ja();aI();Ol();xo();Hb=(t,e,r)=>{r.cwd=V9(r.cwd);let[n,i,o]=q9(t,e,r),{command:s,args:a,options:c}=Y9.default._parse(n,i,o),l=vZ(c),u=jwe(l);return F9(u),Z9(u),H9(u),i9(u),j9(u),u.shell=xR(u.shell),u.env=Mwe(u),u.killSignal=QV(u.killSignal),u.forceKillAfterDelay=r9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),J9.platform==="win32"&&Nwe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jwe=({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}),Mwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...J9.env,...t}:t;return r||n?MV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,lI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function zl(t){if(typeof t=="string")return Fwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lwe(t)}var Fwe,Lwe,X9,zwe,Q9,Uwe,uI=y(()=>{Fwe=t=>t.at(-1)===X9?t.slice(0,t.at(-2)===Q9?-2:-1):t,Lwe=t=>t.at(-1)===zwe?t.subarray(0,t.at(-2)===Uwe?-2:-1):t,X9=` +`,zwe=X9.codePointAt(0),Q9="\r",Uwe=Q9.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 dI(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 fI(t,e){return dI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function eW(){return this[mI].next()}function tW(t){return this[mI].return(t)}function hI({preventCancel:t=!1}={}){let e=this.getReader(),r=new pI(e,t),n=Object.create(Hwe);return n[mI]=r,n}var qwe,pI,mI,Hwe,rW=y(()=>{qwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),pI=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}}},mI=Symbol();Object.defineProperty(eW,"name",{value:"next"});Object.defineProperty(tW,"name",{value:"return"});Hwe=Object.create(qwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:eW},return:{enumerable:!0,configurable:!0,writable:!0,value:tW}})});var nW=y(()=>{});var iW=y(()=>{rW();nW()});var oW,Bwe,Gwe,Zwe,lp,gI=y(()=>{Fa();iW();oW=t=>{if(Ma(t,{checkOpen:!1})&&lp.on!==void 0)return Gwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Bwe.call(t)==="[object ReadableStream]")return hI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Bwe}=Object.prototype,Gwe=async function*(t){let e=new AbortController,r={};Zwe(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()}},Zwe=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 Ul,Vwe,cW,sW,Wwe,aW,ji,up=y(()=>{gI();Ul=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=oW(t),u=e();u.length=0;try{for await(let d of l){let f=Wwe(d),p=r[f](d,u);cW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vwe({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}},Vwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&cW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},cW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){sW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&sW(c,e,i,o),new ji},sW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wwe=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=aW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&aW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:aW}=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 Ul(t,Xwe,e)}var Kwe,Jwe,Ywe,Xwe,lW=y(()=>{up();Wb();Kwe=()=>({contents:[]}),Jwe=()=>1,Ywe=(t,{contents:e})=>(e.push(t),e),Xwe={init:Kwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Jwe,truncateChunk:dp,addChunk:Ywe,getFinalChunk:dp,finalize:Gb}});async function Jb(t,e){return Ul(t,axe,e)}var Qwe,exe,txe,uW,dW,rxe,nxe,ixe,oxe,pW,fW,sxe,mW,axe,hW=y(()=>{up();Wb();Qwe=()=>({contents:new ArrayBuffer(0)}),exe=t=>txe.encode(t),txe=new TextEncoder,uW=t=>new Uint8Array(t),dW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rxe=(t,e)=>t.slice(0,e),nxe=(t,{contents:e,length:r},n)=>{let i=mW()?oxe(e,n):ixe(e,n);return new Uint8Array(i).set(t,r),i},ixe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(pW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oxe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:pW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},pW=t=>fW**Math.ceil(Math.log(t)/Math.log(fW)),fW=2,sxe=({contents:t,length:e})=>mW()?t:t.slice(0,e),mW=()=>"resize"in ArrayBuffer.prototype,axe={init:Qwe,convertChunk:{string:exe,buffer:uW,arrayBuffer:uW,dataView:dW,typedArray:dW,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:nxe,getFinalChunk:dp,finalize:sxe}});async function Xb(t,e){return Ul(t,fxe,e)}var cxe,Yb,lxe,uxe,dxe,fxe,gW=y(()=>{up();Wb();cxe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lxe=(t,{contents:e})=>e+t,uxe=(t,e)=>t.slice(0,e),dxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fxe={init:cxe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:uxe,addChunk:lxe,getFinalChunk:dxe,finalize:Gb}});var yW=y(()=>{lW();hW();gW();up()});import{on as pxe}from"node:events";import{finished as mxe}from"node:stream/promises";var Qb=y(()=>{gI();yW();Object.assign(lp,{on:pxe,finished:mxe})});var _W,hxe,bW,vW,gxe,SW,wW,ev,La=y(()=>{Qb();So();xo();_W=({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=hxe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hxe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",bW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},vW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gxe=(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}},SW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),wW=(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 yxe}from"node:util";var $W,_xe,bxe,vxe,Sxe,wxe,xW,kW=y(()=>{uI();an();aI();lb();La();ip();Da();$W=({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=_xe({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=vxe(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=>Sxe(D)).join(` +`)].map(D=>ep(zl(wxe(D)))).filter(Boolean).join(` + +`);return{originalMessage:x,shortMessage:R,message:T}},_xe=({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=bxe(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?`${vW(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"},bxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vxe=(t,e)=>{if(t instanceof ni)return;let r=UV(t)?t.originalMessage:String(t?.message??t),n=ep(K9(r,e));return n===""?void 0:n},Sxe=t=>typeof t=="string"?t:yxe(t),wxe=t=>Array.isArray(t)?t.map(e=>zl(xW(e))).filter(Boolean).join(` +`):xW(t),xW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,ql,fp,xxe,EW,$xe,pp=y(()=>{ip();hb();Da();kW();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>EW({command:t,escapedCommand:e,cwd:o,durationMs:CR(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:[]}),ql=({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}=$xe(l,u),{originalMessage:T,shortMessage:D,message:E}=$W({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=LV(t,E,x);return Object.assign(ae,xxe({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},xxe=({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})=>EW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:CR(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:[]}),EW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),$xe=(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 kxe(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(AW(t*1e3)%1e3),nanoseconds:Math.trunc(AW(t*1e6)%1e3)}}function Exe(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 yI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kxe(t);break}case"bigint":return Exe(t)}throw new TypeError("Expected a finite number or bigint")}var AW,TW=y(()=>{AW=t=>Number.isFinite(t)?t:0});function _I(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+Oxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Axe(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?" "+Txe(d,u):f;i.push(p)}},a=yI(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%Rxe):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 Axe,Txe,Oxe,Rxe,OW=y(()=>{TW();Axe=t=>t===0||t===0n,Txe=(t,e)=>e===1||e===1n?t:`${t}s`,Oxe=1e-7,Rxe=24n*60n*60n*1000n});var RW,IW=y(()=>{Pl();RW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var PW,Ixe,CW=y(()=>{OW();ps();Pl();IW();PW=(t,e)=>{Rl(e)&&(RW(t,e),Ixe(t,e))},Ixe=(t,e)=>{let r=`(done in ${_I(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Hl,rv=y(()=>{CW();Hl=(t,e,{reject:r})=>{if(PW(t,e),t.failed&&r)throw t;return t}});var jW,Pxe,Cxe,MW,FW,DW,Dxe,bI,NW,za,LW,Nxe,nv,zW,jxe,Mxe,vI,UW,Fxe,qW,iv,Lxe,SI,zxe,Uxe,HW,Cn,ov,wI,BW,GW,ys,$r=y(()=>{Fa();bo();an();jW=(t,e)=>za(t)?"asyncGenerator":LW(t)?"generator":nv(t)?"fileUrl":jxe(t)?"filePath":Lxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":zxe(t)?"asyncIterable":Uxe(t)?"iterable":SI(t)?MW({transform:t},e):Nxe(t)?Pxe(t,e):"native",Pxe=(t,e)=>fI(t.transform,{checkOpen:!1})?Cxe(t,e):SI(t.transform)?MW(t,e):Dxe(t,e),Cxe=(t,e)=>(FW(t,e,"Duplex stream"),"duplex"),MW=(t,e)=>(FW(t,e,"web TransformStream"),"webTransform"),FW=({final:t,binary:e,objectMode:r},n,i)=>{DW(t,`${n}.final`,i),DW(e,`${n}.binary`,i),bI(r,`${n}.objectMode`)},DW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Dxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!NW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(fI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(SI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!NW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return bI(r,`${i}.binary`),bI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},bI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},NW=t=>za(t)||LW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",LW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Nxe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",zW=t=>nv(t)&&t.protocol!=="file:",jxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Mxe.has(e))&&vI(t.file),Mxe=new Set(["file","append"]),vI=t=>typeof t=="string",UW=(t,e)=>t==="native"&&typeof e=="string"&&!Fxe.has(e),Fxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),qW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Lxe=t=>qW(t)||iv(t),SI=t=>qW(t?.readable)&&iv(t?.writable),zxe=t=>HW(t)&&typeof t[Symbol.asyncIterator]=="function",Uxe=t=>HW(t)&&typeof t[Symbol.iterator]=="function",HW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),wI=new Set(["fileUrl","filePath"]),BW=new Set([...wI,"webStream","nodeStream"]),GW=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 xI,qxe,Hxe,ZW,$I=y(()=>{$r();xI=(t,e,r,n)=>n==="output"?qxe(t,e,r):Hxe(t,e,r),qxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hxe=(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}},ZW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var VW,Bxe,Gxe,Zxe,Vxe,Wxe,Kxe,WW=y(()=>{bo();ja();$r();$I();VW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Bxe(t,e,r,n)],Bxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Gxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Kxe(o,r)},Gxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Zxe({stdioItem:t,optionName:i}):e==="webTransform"?Vxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Wxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Zxe=({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}}},Vxe=({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}=xI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Wxe=({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}=xI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Kxe=(t,e)=>e==="input"?t.reverse():t});import kI from"node:process";var KW,Jxe,Yxe,Bl,EI,JW,Xxe,Qxe,YW=y(()=>{Fa();$r();KW=(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)??Qxe},Jxe=({type:t,value:e},r)=>Yxe[r]??JW[t](e),Yxe=["input","output","output"],Bl=()=>{},EI=()=>"input",JW={generator:Bl,asyncGenerator:Bl,fileUrl:Bl,filePath:Bl,iterable:EI,asyncIterable:EI,uint8Array:EI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?dI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Bl,duplex:Bl,native(t){let e=Xxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return JW.nodeStream(t)}},Xxe=t=>{if([0,kI.stdin].includes(t))return"input";if([1,2,kI.stdout,kI.stderr].includes(t))return"output"},Qxe="output"});var XW,QW=y(()=>{XW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var eK,e0e,t0e,tK,r0e,n0e,rK=y(()=>{So();QW();ps();eK=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=e0e(t,n).map((a,c)=>tK(a,c));return o?r0e(s,r,i):XW(s,e)},e0e=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(t0e(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},t0e=t=>Pn.some(e=>t[e]!==void 0),tK=(t,e)=>Array.isArray(t)?t.map(r=>tK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),r0e=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Il(r,i)&&n0e(n)?"ignore":n),n0e=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as i0e}from"node:fs";import o0e from"node:tty";var iK,s0e,a0e,c0e,l0e,nK,oK=y(()=>{Fa();So();an();hs();iK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?s0e({stdioItem:t,fdNumber:n,direction:i}):l0e({stdioItem:t,fdNumber:n}),s0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=a0e({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},a0e=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=c0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(o0e.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(i0e(i)),optionName:e}}},c0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},l0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:nK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:nK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,nK=(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 sK,u0e,d0e,f0e,p0e,aK=y(()=>{Fa();an();$r();sK=({input:t,inputFile:e},r)=>r===0?[...u0e(t),...f0e(e)]:[],u0e=t=>t===void 0?[]:[{type:d0e(t),value:t,optionName:"input"}],d0e=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.")},f0e=t=>t===void 0?[]:[{...p0e(t),optionName:"inputFile"}],p0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(vI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var cK,lK,m0e,h0e,uK,g0e,y0e,dK,fK=y(()=>{$r();cK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),lK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=m0e(i,t);if(s.length!==0){if(o){h0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BW.has(t))return uK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});GW.has(t)&&y0e({otherStdioItems:s,type:t,value:e,optionName:r})}},m0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),h0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{wI.has(e)&&uK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},uK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>g0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return dK(s,n,e),i==="output"?o[0].stream:void 0},g0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,y0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);dK(i,n,e)},dK=(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,_0e,b0e,v0e,S0e,w0e,x0e,$0e,k0e,E0e,A0e,T0e,AI,O0e,av=y(()=>{So();WW();$I();$r();YW();rK();oK();aK();fK();sv=(t,e,r,n)=>{let o=eK(e,r,n).map((a,c)=>_0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=E0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>O0e(a)),s},_0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=b0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=KW(o,e,i),c=o.map(d=>iK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=VW(c,i,a,r),u=ZW(l,a);return k0e(l,u),{direction:a,objectMode:u,stdioItems:l}},b0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>v0e(c,n)),...sK(r,e)],s=cK(o),a=s.length>1;return S0e(s,a,n),x0e(s),{stdioItems:s,isStdioArray:a}},v0e=(t,e)=>({type:jW(t,e),value:t,optionName:e}),S0e=(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(w0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},w0e=new Set(["ignore","ipc"]),x0e=t=>{for(let e of t)$0e(e)},$0e=({type:t,value:e,optionName:r})=>{if(zW(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(UW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},k0e=(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.`)},E0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(A0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw AI(i),o}},A0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>T0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},T0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=lK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},AI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},O0e=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 pK}from"node:fs";var hK,Mi,R0e,gK,mK,I0e,yK=y(()=>{an();av();$r();hK=(t,e)=>sv(I0e,t,e,!0),Mi=({type:t,optionName:e})=>{gK(e,ys[t])},R0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&gK(t,`"${e}"`),{}),gK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},mK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:R0e},I0e={input:{...mK,fileUrl:({value:t})=>({contents:[vo(pK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(pK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...mK,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,TI,mp=y(()=>{uI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?zl(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,RI,_K,bK,P0e,C0e,D0e,vK,N0e,OI,j0e,M0e,F0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:bK(e,n),RI=(t,e,r)=>r?t.flatMap(n=>_K(n,e)):_K(t,e),_K=(t,e)=>{let{transform:r,final:n}=bK(e,{});return[...r(t),...n()]},bK=(t,e)=>(e.previousChunks="",{transform:P0e.bind(void 0,e,t),final:D0e.bind(void 0,e)}),P0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=OI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=OI(n,r.slice(i+1))),t.previousChunks=n},C0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),D0e=function*({previousChunks:t}){t.length>0&&(yield t)},vK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:N0e.bind(void 0,n)},N0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?j0e:F0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},OI=(t,e)=>`${t}${e}`,j0e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:OI},O0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},R0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:O0e}});import{Buffer as I0e}from"node:buffer";var vK,P0e,SK,C0e,D0e,wK,xK=y(()=>{an();vK=(t,e)=>t?void 0:P0e.bind(void 0,e),P0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!I0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},SK=(t,e)=>t?C0e.bind(void 0,e):D0e.bind(void 0,e),C0e=function*(t,e){wK(t,e),yield e},D0e=function*(t,e){if(wK(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},wK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:OI},M0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},F0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:M0e}});import{Buffer as L0e}from"node:buffer";var SK,z0e,wK,U0e,q0e,xK,$K=y(()=>{an();SK=(t,e)=>t?void 0:z0e.bind(void 0,e),z0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!L0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},wK=(t,e)=>t?U0e.bind(void 0,e):q0e.bind(void 0,e),U0e=function*(t,e){xK(t,e),yield e},q0e=function*(t,e){if(xK(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},xK=(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 N0e}from"node:buffer";import{StringDecoder as j0e}from"node:string_decoder";var uv,M0e,F0e,L0e,II=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:M0e.bind(void 0,new TextEncoder)};let n=new j0e(e);return{transform:F0e.bind(void 0,n),final:L0e.bind(void 0,n)}},M0e=function*(t,e){N0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},F0e=function*(t,e){yield qt(e)?t.write(e):e},L0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as $K}from"node:util";var PI,dv,kK,z0e,EK,U0e,AK=y(()=>{PI=$K(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=U0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},kK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*z0e(r,Number(e),t)},z0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},EK=$K(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),U0e=function*(t){yield t}});var CI,TK,Ua,mp,q0e,H0e,DI=y(()=>{CI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...mp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=H0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},mp=function*(t){for(let[e,{final:r}]of Object.entries(t))yield*q0e(r,Number(e),t)},q0e=function*(t,e,r){if(t!==void 0)for(let n of t())yield*Ua(n,r,e+1)},H0e=function*(t){yield t}});import{Transform as B0e,getDefaultHighWaterMark as OK}from"node:stream";var NI,fv,RK,pv=y(()=>{$r();lv();xK();II();AK();DI();NI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=RK(t,s,o),l=za(e),u=za(r),d=l?PI.bind(void 0,dv,a):CI.bind(void 0,Ua),f=l||u?PI.bind(void 0,kK,a):CI.bind(void 0,mp),p=l||u?EK.bind(void 0,a):void 0;return{stream:new B0e({writableObjectMode:n,writableHighWaterMark:OK(n),readableObjectMode:i,readableHighWaterMark:OK(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=RK(s,r,a);t=TK(c,t)}return t},RK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:vK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:SK(i,a)},bK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var IK,G0e,Z0e,V0e,W0e,PK=y(()=>{pv();an();$r();IK=(t,e)=>{for(let r of G0e(t))Z0e(t,r,e)},G0e=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=>V0e(a,n));r.input=Xf(s)},V0e=(t,e)=>{let r=fv(t,e,"utf8",!0);return W0e(r),Xf(r)},W0e=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,K0e,J0e,CK,DK,Y0e,NK,jI=y(()=>{ja();$r();Il();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Rl(r,n)&&!cn.has(e)&&K0e(n)&&(t.some(({type:i,value:o})=>i==="native"&&J0e.has(o))||t.every(({type:i})=>Cn.has(i))),K0e=t=>t===1||t===2,J0e=new Set(["pipe","overlapped"]),CK=async(t,e,r,n)=>{for await(let i of t)Y0e(e)||NK(i,r,n)},DK=(t,e,r)=>{for(let n of t)NK(n,e,r)},Y0e=t=>t._readableState.pipes.length>0,NK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as X0e,appendFileSync as Q0e}from"node:fs";var jK,e$e,t$e,r$e,n$e,i$e,MK=y(()=>{jI();pv();lv();an();$r();La();jK=({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)=>e$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},e$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=SW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=t$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=r$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});n$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&&i$e(b,m,i),S}catch(x){return n.error=x,S}},t$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},r$e=({chunks:t,objectMode:e,encoding:r,lines:n,stripFinalNewline:i,fdNumber:o})=>{if(e)return{serializedResult:t};if(r==="buffer")return{serializedResult:Xf(t)};let s=dZ(t,r);return n[o]?{serializedResult:s,finalResult:RI(s,!i[o],e)}:{serializedResult:s}},n$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=RI(t,!1,s);try{DK(a,e,n)}catch(c){r.error??=c}},i$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)?Q0e(n,t):(r.add(o),X0e(n,t))}}});var FK,LK=y(()=>{an();pp();FK=([,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)?kR([t,e]):`${t}${e}`}});import{once as MI}from"node:events";var zK,o$e,UK,qK,s$e,FI,LI=y(()=>{Da();zK=async(t,e)=>{let[r,n]=await o$e(t);return e.isForcefullyTerminated??=!1,[r,n]},o$e=async t=>{let[e,r]=await Promise.allSettled([MI(t,"spawn"),MI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?UK(t):r.value},UK=async t=>{try{return await MI(t,"exit")}catch{return UK(t)}},qK=async t=>{let[e,r]=await t;if(!s$e(e,r)&&FI(e,r))throw new ni;return[e,r]},s$e=(t,e)=>t===void 0&&e===void 0,FI=(t,e)=>t!==0||e!==null});var HK,a$e,BK=y(()=>{Da();La();LI();HK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=a$e(t,e,r),s=o?.code==="ETIMEDOUT",a=vW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},a$e=(t,e,r)=>t!==void 0?t:FI(e,r)?new ni:void 0});import{spawnSync as c$e}from"node:child_process";var GK,l$e,u$e,d$e,hv,f$e,p$e,m$e,h$e,ZK=y(()=>{DR();cI();lI();fp();rv();gK();pp();PK();MK();La();LK();BK();GK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=l$e(t,e,r),d=f$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return ql(d,c,l)},l$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=u$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);d$e(u);let d=mK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},u$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,d$e=({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.`)},f$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=p$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}=HK(c,r),{output:m,error:h=l}=jK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(FK(m,r),r,"all");return h$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},p$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{IK(o,r);let a=m$e(r);return c$e(...Bb(t,e,a))}catch(a){return Ul({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},m$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),h$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?tv({command:c,escapedCommand:l,stdio:o,all:s,ipcOutput:[],options:a,startTime:u}):dp({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 zI,on as g$e}from"node:events";var VK,y$e,_$e,b$e,v$e,WK=y(()=>{jl();sp();op();VK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Dl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),y$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),y$e=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([_$e(o,n,s),b$e(o,r,s),v$e(o,r,s)])}catch(a){throw Nl(t),a}finally{s.abort(),Rb(e,i)}},_$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await zI(t,"message",{signal:r});return n}for await(let[n]of g$e(t,"message",{signal:r}))if(e(n))return n},b$e=async(t,e,{signal:r})=>{await zI(t,"disconnect",{signal:r}),o9(e)},v$e=async(t,e,{signal:r})=>{let[n]=await zI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as JK,on as S$e}from"node:events";var YK,UI,w$e,x$e,$$e,KK,qI=y(()=>{jl();sp();op();YK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>UI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),UI=({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 w$e(t,s,a),x$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})},w$e=async(t,e,r)=>{try{await JK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},x$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await JK(t,"strict:error",{signal:r.signal});n.error=kb(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 S$e(r,"message",{signal:o.signal}))KK(s),yield c}catch{KK(s)}finally{o.abort(),Rb(e,a),n||Nl(t),i&&await t}},KK=({error:t})=>{if(t)throw t}});import XK from"node:process";var QK,e3,t3,HI=y(()=>{Ub();WK();qI();Db();QK=(t,{ipc:e})=>{Object.assign(t,t3(t,!1,e))},e3=()=>{let t=XK,e=!0,r=XK.channel!==void 0;return{...t3(t,e,r),getCancelSignal:C9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},t3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:VK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:YK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as k$e}from"node:child_process";import{PassThrough as E$e,Readable as A$e,Writable as T$e,Duplex as O$e}from"node:stream";var r3,R$e,hp,I$e,P$e,C$e,D$e,n3=y(()=>{av();fp();rv();r3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{AI(n);let a=new k$e;R$e(a,n),Object.assign(a,{readable:I$e,writable:P$e,duplex:C$e});let c=Ul({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=D$e(c,s,i);return{subprocess:a,promise:l}},R$e=(t,e)=>{let r=hp(),n=hp(),i=hp(),o=Array.from({length:e.length-3},hp),s=hp(),a=[r,n,i,...o];Object.assign(t,{stdin:r,stdout:n,stderr:i,all:s,stdio:a})},hp=()=>{let t=new E$e;return t.end(),t},I$e=()=>new A$e({read(){}}),P$e=()=>new T$e({write(){}}),C$e=()=>new O$e({read(){},write(){}}),D$e=async(t,e,r)=>ql(t,e,r)});import{createReadStream as i3,createWriteStream as o3}from"node:fs";import{Buffer as N$e}from"node:buffer";import{Readable as gp,Writable as j$e,Duplex as M$e}from"node:stream";var a3,yp,s3,F$e,c3=y(()=>{pv();av();$r();a3=(t,e)=>sv(F$e,t,e,!1),yp=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},s3={fileNumber:yp,generator:NI,asyncGenerator:NI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:M$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},F$e={input:{...s3,fileUrl:({value:t})=>({stream:i3(t)}),filePath:({value:{file:t}})=>({stream:i3(t)}),webStream:({value:t})=>({stream:gp.fromWeb(t)}),iterable:({value:t})=>({stream:gp.from(t)}),asyncIterable:({value:t})=>({stream:gp.from(t)}),string:({value:t})=>({stream:gp.from(t)}),uint8Array:({value:t})=>({stream:gp.from(N$e.from(t))})},output:{...s3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t,append:e}})=>({stream:o3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:j$e.fromWeb(t)}),iterable:yp,asyncIterable:yp,string:yp,uint8Array:yp}}});import{on as L$e,once as l3}from"node:events";import{PassThrough as z$e,getDefaultHighWaterMark as U$e}from"node:stream";import{finished as f3}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)GI(i);let e=t.some(({readableObjectMode:i})=>i),r=q$e(t,e),n=new BI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var q$e,BI,H$e,B$e,G$e,GI,Z$e,V$e,W$e,K$e,J$e,p3,m3,ZI,h3,Y$e,gv,u3,d3,yv=y(()=>{q$e=(t,e)=>{if(t.length===0)return U$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},BI=class extends z$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(GI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=H$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(GI(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)}},H$e=async(t,e,r)=>{gv(t,u3);let n=new AbortController;try{await Promise.race([B$e(t,n),G$e(t,e,r,n)])}finally{n.abort(),gv(t,-u3)}},B$e=async(t,{signal:e})=>{try{await f3(t,{signal:e,cleanup:!0})}catch(r){throw p3(t,r),r}},G$e=async(t,e,r,{signal:n})=>{for await(let[i]of L$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},GI=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})=>{gv(t,d3);let a=new AbortController;try{await Promise.race([V$e(o,e,a),W$e({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),K$e({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-d3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZI(t):J$e(t))},V$e=async(t,e,{signal:r})=>{try{await t,r.aborted||ZI(e)}catch(n){r.aborted||p3(e,n)}},W$e=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await f3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;m3(s)?i.add(e):h3(t,s)}},K$e=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await l3(t,i,{signal:o}),!t.readable)return l3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},J$e=t=>{t.writable&&t.end()},p3=(t,e)=>{m3(e)?ZI(t):h3(t,e)},m3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZI=t=>{(t.readable||t.writable)&&t.destroy()},h3=(t,e)=>{t.destroyed||(t.once("error",Y$e),t.destroy(e))},Y$e=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},u3=2,d3=1});import{finished as g3}from"node:stream/promises";var Bl,X$e,VI,Q$e,WI,_v=y(()=>{So();Bl=(t,e)=>{t.pipe(e),X$e(t,e),Q$e(t,e)},X$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}VI(e)}},VI=t=>{t.writable&&t.end()},Q$e=async(t,e)=>{if(!(ri(t)||ri(e))){try{await g3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}WI(t)}},WI=t=>{t.readable&&t.destroy()}});var y3,eke,tke,rke,nke,ike,_3=y(()=>{yv();So();Tb();$r();_v();y3=(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})=>Cn.has(c)))eke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))rke({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);Bl(s,i)}},eke=(t,e,r,n)=>{r==="output"?Bl(t.stdio[n],e):Bl(e,t.stdio[n]);let i=tke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},tke=["stdin","stdout","stderr"],rke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;nke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},nke=(t,{signal:e})=>{ri(t)&&Na(t,ike,e)},ike=2});var Ha,b3=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 bv,KI,JI,oke,YI,vv,ske,XI,QI,eP,v3,Kct,Jct,S3=y(()=>{b3();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",KI=Symbol.for("signal-exit emitter"),JI=globalThis,oke=Object.defineProperty.bind(Object),YI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(JI[KI])return JI[KI];oke(JI,KI,{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{},ske=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),XI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},QI=class extends vv{#t=eP.platform==="win32"?"SIGINT":"SIGHUP";#r=new YI;#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(!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 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 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)}},eP=globalThis.process,{onExit:v3,load:Kct,unload:Jct}=ske(bv(eP)?new QI(eP):new XI)});import{addAbortListener as ake}from"node:events";var w3,x3=y(()=>{S3();w3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=v3(()=>{t.kill()});ake(n,()=>{i()})}});var k3,cke,lke,$3,uke,E3=y(()=>{$R();hb();hs();Tl();k3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=cke(r,n,i),{sourceStream:d,sourceError:f}=uke(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}},cke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=lke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},lke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e($3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||wR(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($3)(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}`)},$3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),uke=(t,e)=>{try{return{sourceStream:Fl(t,e)}}catch(r){return{sourceError:r}}}});var T3,dke,tP,A3,rP=y(()=>{fp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=dke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw tP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},dke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return WI(t),n;if(e!==void 0)return VI(r),e},tP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>Ul({error:t,command:A3,escapedCommand:A3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),A3="source.pipe(destination)"});var O3,R3=y(()=>{O3=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 fke}from"node:stream/promises";var I3,pke,mke,hke,Sv,gke,yke,P3=y(()=>{yv();Tb();_v();I3=(t,e,r)=>{let n=Sv.has(e)?mke(t,e):pke(t,e);return Na(t,gke,r.signal),Na(e,yke,r.signal),hke(e),n},pke=(t,e)=>{let r=qa([t]);return Bl(r,e),Sv.set(e,r),r},mke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},hke=async t=>{try{await fke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,gke=2,yke=1});import{aborted as _ke}from"node:util";var C3,bke,D3=y(()=>{rP();C3=(t,e)=>t===void 0?[]:[bke(t,e)],bke=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await _ke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw tP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,vke,Ske,N3=y(()=>{bo();E3();rP();R3();P3();D3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=k3(t,...e),i=vke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},vke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Ske(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=I3(e,o,d);return await Promise.race([O3(u),...C3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Ske=(t,e)=>Promise.allSettled([t,e])});import{on as wke}from"node:events";import{getDefaultHighWaterMark as xke}from"node:stream";var xv,$ke,nP,kke,M3,iP,j3,Eke,Ake,$v=y(()=>{II();lv();DI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return $ke(e,s),M3({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()}},nP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;kke(e,s,t);let a=t.readableObjectMode&&!o;return M3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},kke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},M3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=wke(t,"data",{signal:e.signal,highWaterMark:j3,highWatermark:j3});return Eke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},iP=xke(!0),j3=iP,Eke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Ake({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*mp(a)}},Ake=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as Tke}from"node:timers/promises";var F3,Oke,Rke,Ike,oP,L3,sP=y(()=>{Qb();an();jI();$v();La();pp();F3=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=Oke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Rke(t),d]);return}let f=TI(c,r),p=nP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Ike({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Oke=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=nP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await CK(a,t,r,o)},Rke=async t=>{await Tke(),t.readableFlowing===null&&t.resume()},Ike=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 L3(yW({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},oP=async t=>{try{return await t}catch(e){return L3(e)}},L3=({bufferedData:t})=>lZ(t)?new Uint8Array(t):t});import{finished as Pke}from"node:stream/promises";var _p,Cke,Dke,Nke,jke,Mke,aP,kv,z3,Ev=y(()=>{_p=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Cke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],Pke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||jke(a,e,r,n)}finally{s.abort()}},Cke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&Dke(t,r,n),n},Dke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Nke(e,r),n.call(t,...i)}},Nke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},jke=(t,e,r,n)=>{if(!Mke(t,e,r,n))throw t},Mke=(t,e,r,n=!0)=>r.propagating?z3(t)||kv(t):(r.propagating=!0,aP(r,e)===n?z3(t):kv(t)),aP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",z3=t=>t?.code==="EPIPE"});var U3,cP,lP=y(()=>{sP();Ev();U3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>cP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),cP=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=_p(t,e,l);if(aP(l,e)){await u;return}let[d]=await Promise.all([F3({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 q3,H3,Fke,Lke,uP=y(()=>{yv();lP();q3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,H3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>cP({...Fke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Lke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Fke=({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}},Lke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var B3,G3,Z3=y(()=>{Il();ps();B3=t=>Rl(t,"ipc"),G3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var V3,W3,K3=y(()=>{La();Z3();xo();qI();V3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=B3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of UI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(_W(t,i,c),i.push(l)),s&&G3(l,o);return i},W3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as zke}from"node:events";var J3,Uke,qke,Hke,Y3=y(()=>{Fa();nI();WR();rI();So();$r();sP();K3();oI();uP();lP();LI();Ev();J3=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 _=zK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=U3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=H3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=V3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Uke(h,t,S),D=qke(m,S);try{return await Promise.race([Promise.all([{},qK(_),Promise.all(x),w,A,H9(t,d),...T,...D]),g,Hke(t,b),...F9(t,o,f,b),...i9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...j9({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=>oP(ae))),oP(w),W3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Uke=(t,e,r)=>t.map((n,i)=>n===e.stdio[i]?void 0:_p(n,i,r)),qke=(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})=>_p(s,n,e,{isSameDirection:Cn.has(i),stopOnExit:i==="native"}))),Hke=async(t,{signal:e})=>{let[r]=await zke(t,"error",{signal:e});throw r}});var X3,bp,Gl,Av=y(()=>{Ml();X3=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),bp=(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 Q3}from"node:stream/promises";var dP,eJ,fP,pP,Tv,Ov,mP=y(()=>{Ev();dP=async t=>{if(t!==void 0)try{await fP(t)}catch{}},eJ=async t=>{if(t!==void 0)try{await pP(t)}catch{}},fP=async t=>{await Q3(t,{cleanup:!0,readable:!1,writable:!0})},pP=async t=>{await Q3(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 Bke}from"node:stream";import{callbackify as Gke}from"node:util";var tJ,hP,gP,yP,Zke,_P,bP,rJ,vP=y(()=>{ja();hs();$v();Ml();Av();mP();tJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=hP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=gP(a,s),{read:f,onStdoutDataDone:p}=yP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Bke({read:f,destroy:Gke(bP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _P({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},hP=(t,e,r)=>{let n=Fl(t,e),i=bp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},gP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:iP},yP=({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{}},_P=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await pP(t),await n,await dP(i),await e,r.readable&&r.push(null)}catch(o){await dP(i),rJ(r,o)}},bP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Gl(r,e)&&(rJ(t,n),await Tv(e,n))},rJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as Vke}from"node:stream";import{callbackify as nJ}from"node:util";var iJ,SP,wP,Wke,Kke,xP,$P,oJ,kP=y(()=>{hs();Av();mP();iJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=SP(t,r,e),s=new Vke({...wP(n,t,i),destroy:nJ($P.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xP(n,s),s},SP=(t,e,r)=>{let n=Ab(t,e),i=bp(r,n,"writableFinal"),o=bp(r,n,"writableDestroy");return{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}},wP=(t,e,r)=>({write:Wke.bind(void 0,t),final:nJ(Kke.bind(void 0,t,e,r))}),Wke=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},Kke=async(t,e,r)=>{await Gl(r,e)&&(t.writable&&t.end(),await e)},xP=async(t,e,r)=>{try{await fP(t),e.writable&&e.end()}catch(n){await eJ(r),oJ(e,n)}},$P=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Gl(r,e),await Gl(n,e)&&(oJ(t,i),await Tv(e,i))},oJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as Jke}from"node:stream";import{callbackify as Yke}from"node:util";var sJ,Xke,aJ=y(()=>{ja();vP();kP();sJ=({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}=hP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=SP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=gP(c,a),{read:g,onStdoutDataDone:b}=yP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new Jke({read:g,...wP(u,t,d),destroy:Yke(Xke.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 _P({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),xP(u,_,c),_},Xke=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([bP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),$P({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var EP,Qke,cJ=y(()=>{ja();hs();$v();EP=(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 Qke(a,s,t)},Qke=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var lJ,uJ=y(()=>{Av();vP();kP();aJ();cJ();lJ=(t,{encoding:e})=>{let r=X3();t.readable=tJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=iJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=sJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=EP.bind(void 0,t,e),t[Symbol.asyncIterator]=EP.bind(void 0,t,e,{})}});var dJ,eEe,tEe,fJ=y(()=>{dJ=(t,e)=>{for(let[r,n]of tEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},eEe=(async()=>{})().constructor.prototype,tEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(eEe,t)])});import{setMaxListeners as rEe}from"node:events";import{spawn as nEe}from"node:child_process";var pJ,iEe,oEe,sEe,aEe,cEe,mJ=y(()=>{Qb();DR();cI();hs();lI();HI();fp();rv();n3();c3();pp();_3();xb();x3();N3();uP();Y3();uJ();Ml();fJ();pJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=iEe(t,e,r),{subprocess:f,promise:p}=sEe({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}),dJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},iEe=(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=oEe(l),d=a3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},oEe=({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}},sEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=nEe(...Bb(t,e,r))}catch(m){return r3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;rEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];y3(c,a,l),w3(c,r,l);let d={},f=Di();c.kill=r9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=q3(c,r),lJ(c,r),QK(c,r);let p=aEe({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}},aEe=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 J3({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=cEe({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)},cEe=({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?dp({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,lEe,uEe,hJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,lEe(n,t[n],i)]));return{...t,...r}},lEe=(t,e,r)=>uEe.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,uEe=new Set(["env",...OR])});var _s,dEe,fEe,gJ=y(()=>{bo();$R();yZ();ZK();mJ();hJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>dEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},dEe=({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}=fEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?GK(a,c,l):pJ(a,c,l,i)},fEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=hZ(e)?gZ(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 yJ,_J,bJ,pEe,mEe,vJ=y(()=>{yJ=({file:t,commandArguments:e})=>bJ(t,e),_J=({file:t,commandArguments:e})=>({...bJ(t,e),isSync:!0}),bJ=(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]=pEe(t);return{file:r,commandArguments:n}},pEe=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(mEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},mEe=/ +/g});var SJ,wJ,hEe,xJ,gEe,$J,kJ=y(()=>{SJ=(t,e,r)=>{t.sync=e(hEe,r),t.s=t.sync},wJ=({options:t})=>xJ(t),hEe=({options:t})=>({...xJ(t),isSync:!0}),xJ=t=>({options:{...gEe(t),...t}}),gEe=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},$J={preferLocal:!0}});var Ldt,Ke,zdt,Udt,qdt,Hdt,Bdt,Gdt,Zdt,Vdt,zr=y(()=>{gJ();vJ();iI();kJ();HI();Ldt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),zdt=_s(yJ),Udt=_s(_J),qdt=_s(z9),Hdt=_s(wJ,{},$J,SJ),{sendMessage:Bdt,getOneMessage:Gdt,getEachMessage:Zdt,getCancelSignal:Vdt}=e3()});import{existsSync as Iv,statSync as yEe}from"node:fs";import{dirname as AP,extname as _Ee,isAbsolute as EJ,join as TP,relative as OP,resolve as Pv,sep as bEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function vEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function SEe(t,e){let n=OP(t,e).split(bEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function wEe(t,e){let r=Pv(t,e),n=r;Iv(r)?yEe(r).isFile()&&(n=AP(r)):_Ee(r)!==""&&(n=AP(r));let i=OP(t,n);if(i.startsWith("..")||EJ(i))return null;let o=n;for(;;){if(vEe(o))return o;if(Pv(o)===Pv(t))return null;let s=AP(o);if(s===o)return null;let a=OP(t,s);if(a.startsWith("..")||EJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=wEe(r,o);if(!s){i.push(o);continue}let a=SEe(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 IP,readFileSync as xEe}from"node:fs";import{join as Zl}from"node:path";function Vl(t="."){let e=Zl(t,".cladding","config.yaml");if(!IP(e))return RP;try{let n=(0,AJ.parse)(xEe(e,"utf8"))?.gate;if(!n)return RP;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 RP}}function TJ(t="."){let e=Vl(t).testReport,r=e?[e,...PP]:PP;return[...new Set(r.map(n=>Zl(t,n)))]}function OJ(t="."){let e=Vl(t).testReport;if(e){let r=Zl(t,e);return IP(r)?r:null}return PP.map(r=>Zl(t,r)).find(r=>IP(r))??null}function RJ(t,e){let r=[],n=!1;for(let i of t){let o=kEe.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 AJ,$Ee,RP,PP,kEe,vp=y(()=>{"use strict";AJ=wt(tr(),1);Nv();$Ee=["type","lint","test","coverage"],RP={scope:"feature"},PP=["test-report.junit.xml",Zl("coverage","junit.xml"),Zl(".cladding","test-report.junit.xml")];kEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as DP,readFileSync as IJ,readdirSync as EEe,statSync as AEe}from"node:fs";import{join as jv}from"node:path";function MP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(DP(r))try{if(PJ.test(IJ(r,"utf8")))return!0}catch{}}return!1}function CJ(t){try{return DP(t)&&PJ.test(IJ(t,"utf8"))}catch{return!1}}function DJ(t,e=0){if(e>4||!DP(t))return!1;let r;try{r=EEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=AEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(DJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&CJ(i))return!0}return!1}function REe(t){if(MP(t))return!0;for(let e of TEe)if(CJ(jv(t,e)))return!0;for(let e of OEe)if(DJ(jv(t,e)))return!0;return!1}function NJ(t="."){let e=Vl(t).coverage;return e||(REe(t)?"kover":"jacoco")}function jJ(t="."){return NP[NJ(t)]}function MJ(t="."){return CP[NJ(t)]}var NP,CP,jP,PJ,TEe,OEe,Mv=y(()=>{"use strict";vp();NP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},CP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},jP=[CP.kover,CP.jacoco],PJ=/kover/i;TEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],OEe=["buildSrc","build-logic"]});import{existsSync as wp,readFileSync as LP,readdirSync as LJ,statSync as IEe}from"node:fs";import{dirname as PEe,join as kr,resolve as CEe}from"node:path";import Wl from"node:process";function zP(t){return wp(kr(t,"gradlew"))?"./gradlew":"gradle"}function DEe(t){let e=zP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[jJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function NEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LP(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 MEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function zEe(t,e){for(let r of e)if(wp(kr(t,r)))return r}function UEe(t,e){try{return LJ(t).find(n=>n.endsWith(e))}catch{return}}function GEe(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=CEe(t);;){e.push(kr(o,".madgerc"));let s=PEe(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 zJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function WEe(t){try{return IEe(t).isFile()}catch{return!1}}function KEe(t){let e;try{e=LP(t,"utf8")}catch{return!0}try{return zJ(JSON.parse(e).excludeRegExp)}catch{return VEe.test(e)}}function JEe(t,e){let r=e.madge;return r&&typeof r=="object"&&zJ(r.excludeRegExp)||ZEe()?!0:GEe(t).some(n=>WEe(n)&&KEe(n))}function YEe(t){try{return JSON.parse(LP(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 FJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function XEe(t,e,r){if(JEe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",BEe),{...e,args:n}}function QEe(t,e,r){if(Sp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of qEe)if(n.configs.some(i=>wp(kr(t,i))))return n.gate;if(HEe.some(n=>wp(kr(t,n)))||r.eslintConfig!==void 0)return e}function tAe(t,e){return eAe.some(r=>wp(kr(t,r)))?!0:e.jest!==void 0}function rAe(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 FP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function nAe(t,e){let r=YEe(t),n=e.lint?QEe(t,e.lint,r):void 0,i=e.arch?{...e,arch:XEe(t,e.arch,r)}:e,o=n?{...i,lint:n}:FP(i,"lint"),s=Sp(r,"test"),a=s?rAe(s):void 0;return s&&!a?(o=FP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...Sp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&tAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!Sp(r,"coverage")&&!FJ(r,"@vitest/coverage-v8")&&!FJ(r,"@vitest/coverage-istanbul")?o=FP(o,"coverage"):a==="vitest"&&Sp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of FEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=UEe(t,o):r=zEe(t,[o]),r)break;if(!r||e.requiresSource&&!MEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?nAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return LEe}var Fi,jEe,FEe,LEe,qEe,HEe,BEe,VEe,eAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];jEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);FEe=[{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:DEe},{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:NEe}],LEe={language:"unknown",manifest:"",gates:{}};qEe=[{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"]}}],HEe=["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"],BEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";VEe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;eAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as iAe,readFileSync as oAe}from"node:fs";import{join as sAe}from"node:path";function Ba(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 UJ.test(o)||UJ.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 H0e}from"node:buffer";import{StringDecoder as B0e}from"node:string_decoder";var uv,G0e,Z0e,V0e,II=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:G0e.bind(void 0,new TextEncoder)};let n=new B0e(e);return{transform:Z0e.bind(void 0,n),final:V0e.bind(void 0,n)}},G0e=function*(t,e){H0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},Z0e=function*(t,e){yield qt(e)?t.write(e):e},V0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as kK}from"node:util";var PI,dv,EK,W0e,AK,K0e,TK=y(()=>{PI=kK(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=K0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},EK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*W0e(r,Number(e),t)},W0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},AK=kK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),K0e=function*(t){yield t}});var CI,OK,Ua,hp,J0e,Y0e,DI=y(()=>{CI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},OK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...hp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Y0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},hp=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)},Y0e=function*(t){yield t}});import{Transform as X0e,getDefaultHighWaterMark as RK}from"node:stream";var NI,fv,IK,pv=y(()=>{$r();lv();$K();II();TK();DI();NI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=IK(t,s,o),l=za(e),u=za(r),d=l?PI.bind(void 0,dv,a):CI.bind(void 0,Ua),f=l||u?PI.bind(void 0,EK,a):CI.bind(void 0,hp),p=l||u?AK.bind(void 0,a):void 0;return{stream:new X0e({writableObjectMode:n,writableHighWaterMark:RK(n),readableObjectMode:i,readableHighWaterMark:RK(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=IK(s,r,a);t=OK(c,t)}return t},IK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:SK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:wK(i,a)},vK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var PK,Q0e,e$e,t$e,r$e,CK=y(()=>{pv();an();$r();PK=(t,e)=>{for(let r of Q0e(t))e$e(t,r,e)},Q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),e$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=>t$e(a,n));r.input=Qf(s)},t$e=(t,e)=>{let r=fv(t,e,"utf8",!0);return r$e(r),Qf(r)},r$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,n$e,i$e,DK,NK,o$e,jK,jI=y(()=>{ja();$r();Pl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Il(r,n)&&!cn.has(e)&&n$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&i$e.has(o))||t.every(({type:i})=>Cn.has(i))),n$e=t=>t===1||t===2,i$e=new Set(["pipe","overlapped"]),DK=async(t,e,r,n)=>{for await(let i of t)o$e(e)||jK(i,r,n)},NK=(t,e,r)=>{for(let n of t)jK(n,e,r)},o$e=t=>t._readableState.pipes.length>0,jK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as s$e,appendFileSync as a$e}from"node:fs";var MK,c$e,l$e,u$e,d$e,f$e,FK=y(()=>{jI();pv();lv();an();$r();La();MK=({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)=>c$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},c$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=wW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=l$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=u$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});d$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&&f$e(b,m,i),S}catch(x){return n.error=x,S}},l$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},u$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=fZ(t,r);return n[o]?{serializedResult:s,finalResult:RI(s,!i[o],e)}:{serializedResult:s}},d$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=RI(t,!1,s);try{NK(a,e,n)}catch(c){r.error??=c}},f$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)?a$e(n,t):(r.add(o),s$e(n,t))}}});var LK,zK=y(()=>{an();mp();LK=([,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)?kR([t,e]):`${t}${e}`}});import{once as MI}from"node:events";var UK,p$e,qK,HK,m$e,FI,LI=y(()=>{Da();UK=async(t,e)=>{let[r,n]=await p$e(t);return e.isForcefullyTerminated??=!1,[r,n]},p$e=async t=>{let[e,r]=await Promise.allSettled([MI(t,"spawn"),MI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qK(t):r.value},qK=async t=>{try{return await MI(t,"exit")}catch{return qK(t)}},HK=async t=>{let[e,r]=await t;if(!m$e(e,r)&&FI(e,r))throw new ni;return[e,r]},m$e=(t,e)=>t===void 0&&e===void 0,FI=(t,e)=>t!==0||e!==null});var BK,h$e,GK=y(()=>{Da();La();LI();BK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=h$e(t,e,r),s=o?.code==="ETIMEDOUT",a=SW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},h$e=(t,e,r)=>t!==void 0?t:FI(e,r)?new ni:void 0});import{spawnSync as g$e}from"node:child_process";var ZK,y$e,_$e,b$e,hv,v$e,S$e,w$e,x$e,VK=y(()=>{DR();cI();lI();pp();rv();yK();mp();CK();FK();La();zK();GK();ZK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=y$e(t,e,r),d=v$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Hl(d,c,l)},y$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=_$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);b$e(u);let d=hK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,b$e=({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.`)},v$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=S$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}=BK(c,r),{output:m,error:h=l}=MK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(LK(m,r),r,"all");return x$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},S$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{PK(o,r);let a=w$e(r);return g$e(...Bb(t,e,a))}catch(a){return ql({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},w$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),x$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?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 zI,on as $$e}from"node:events";var WK,k$e,E$e,A$e,T$e,KK=y(()=>{Ml();ap();sp();WK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Nl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),k$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),k$e=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([E$e(o,n,s),A$e(o,r,s),T$e(o,r,s)])}catch(a){throw jl(t),a}finally{s.abort(),Rb(e,i)}},E$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await zI(t,"message",{signal:r});return n}for await(let[n]of $$e(t,"message",{signal:r}))if(e(n))return n},A$e=async(t,e,{signal:r})=>{await zI(t,"disconnect",{signal:r}),s9(e)},T$e=async(t,e,{signal:r})=>{let[n]=await zI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as YK,on as O$e}from"node:events";var XK,UI,R$e,I$e,P$e,JK,qI=y(()=>{Ml();ap();sp();XK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>UI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),UI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Nl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Ob(e,o);let s=gs(t,e,r),a=new AbortController,c={};return R$e(t,s,a),I$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),P$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},R$e=async(t,e,r)=>{try{await YK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},I$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await YK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},P$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 O$e(r,"message",{signal:o.signal}))JK(s),yield c}catch{JK(s)}finally{o.abort(),Rb(e,a),n||jl(t),i&&await t}},JK=({error:t})=>{if(t)throw t}});import QK from"node:process";var e3,t3,r3,HI=y(()=>{Ub();KK();qI();Db();e3=(t,{ipc:e})=>{Object.assign(t,r3(t,!1,e))},t3=()=>{let t=QK,e=!0,r=QK.channel!==void 0;return{...r3(t,e,r),getCancelSignal:D9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},r3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:WK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:XK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as C$e}from"node:child_process";import{PassThrough as D$e,Readable as N$e,Writable as j$e,Duplex as M$e}from"node:stream";var n3,F$e,gp,L$e,z$e,U$e,q$e,i3=y(()=>{av();pp();rv();n3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{AI(n);let a=new C$e;F$e(a,n),Object.assign(a,{readable:L$e,writable:z$e,duplex:U$e});let c=ql({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=q$e(c,s,i);return{subprocess:a,promise:l}},F$e=(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 D$e;return t.end(),t},L$e=()=>new N$e({read(){}}),z$e=()=>new j$e({write(){}}),U$e=()=>new M$e({read(){},write(){}}),q$e=async(t,e,r)=>Hl(t,e,r)});import{createReadStream as o3,createWriteStream as s3}from"node:fs";import{Buffer as H$e}from"node:buffer";import{Readable as yp,Writable as B$e,Duplex as G$e}from"node:stream";var c3,_p,a3,Z$e,l3=y(()=>{pv();av();$r();c3=(t,e)=>sv(Z$e,t,e,!1),_p=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},a3={fileNumber:_p,generator:NI,asyncGenerator:NI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:G$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Z$e={input:{...a3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t}})=>({stream:o3(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(H$e.from(t))})},output:{...a3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t,append:e}})=>({stream:s3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:B$e.fromWeb(t)}),iterable:_p,asyncIterable:_p,string:_p,uint8Array:_p}}});import{on as V$e,once as u3}from"node:events";import{PassThrough as W$e,getDefaultHighWaterMark as K$e}from"node:stream";import{finished as p3}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)GI(i);let e=t.some(({readableObjectMode:i})=>i),r=J$e(t,e),n=new BI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var J$e,BI,Y$e,X$e,Q$e,GI,eke,tke,rke,nke,ike,m3,h3,ZI,g3,oke,gv,d3,f3,yv=y(()=>{J$e=(t,e)=>{if(t.length===0)return K$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},BI=class extends W$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(GI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Y$e(this,this.#t,this.#o);let r=eke({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(GI(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)}},Y$e=async(t,e,r)=>{gv(t,d3);let n=new AbortController;try{await Promise.race([X$e(t,n),Q$e(t,e,r,n)])}finally{n.abort(),gv(t,-d3)}},X$e=async(t,{signal:e})=>{try{await p3(t,{signal:e,cleanup:!0})}catch(r){throw m3(t,r),r}},Q$e=async(t,e,r,{signal:n})=>{for await(let[i]of V$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},GI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},eke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,f3);let a=new AbortController;try{await Promise.race([tke(o,e,a),rke({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),nke({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-f3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZI(t):ike(t))},tke=async(t,e,{signal:r})=>{try{await t,r.aborted||ZI(e)}catch(n){r.aborted||m3(e,n)}},rke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await p3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;h3(s)?i.add(e):g3(t,s)}},nke=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await u3(t,i,{signal:o}),!t.readable)return u3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},ike=t=>{t.writable&&t.end()},m3=(t,e)=>{h3(e)?ZI(t):g3(t,e)},h3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZI=t=>{(t.readable||t.writable)&&t.destroy()},g3=(t,e)=>{t.destroyed||(t.once("error",oke),t.destroy(e))},oke=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},d3=2,f3=1});import{finished as y3}from"node:stream/promises";var Gl,ske,VI,ake,WI,_v=y(()=>{So();Gl=(t,e)=>{t.pipe(e),ske(t,e),ake(t,e)},ske=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}VI(e)}},VI=t=>{t.writable&&t.end()},ake=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}WI(t)}},WI=t=>{t.readable&&t.destroy()}});var _3,cke,lke,uke,dke,fke,b3=y(()=>{yv();So();Tb();$r();_v();_3=(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})=>Cn.has(c)))cke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))uke({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);Gl(s,i)}},cke=(t,e,r,n)=>{r==="output"?Gl(t.stdio[n],e):Gl(e,t.stdio[n]);let i=lke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},lke=["stdin","stdout","stderr"],uke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;dke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},dke=(t,{signal:e})=>{ri(t)&&Na(t,fke,e)},fke=2});var Ha,v3=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 bv,KI,JI,pke,YI,vv,mke,XI,QI,eP,S3,alt,clt,w3=y(()=>{v3();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",KI=Symbol.for("signal-exit emitter"),JI=globalThis,pke=Object.defineProperty.bind(Object),YI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(JI[KI])return JI[KI];pke(JI,KI,{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{},mke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),XI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},QI=class extends vv{#t=eP.platform==="win32"?"SIGINT":"SIGHUP";#r=new YI;#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(!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 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 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)}},eP=globalThis.process,{onExit:S3,load:alt,unload:clt}=mke(bv(eP)?new QI(eP):new XI)});import{addAbortListener as hke}from"node:events";var x3,$3=y(()=>{w3();x3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=S3(()=>{t.kill()});hke(n,()=>{i()})}});var E3,gke,yke,k3,_ke,A3=y(()=>{$R();hb();hs();Ol();E3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=gke(r,n,i),{sourceStream:d,sourceError:f}=_ke(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}},gke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=yke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},yke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(k3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||wR(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(k3)(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}`)},k3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_ke=(t,e)=>{try{return{sourceStream:Ll(t,e)}}catch(r){return{sourceError:r}}}});var O3,bke,tP,T3,rP=y(()=>{pp();_v();O3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw tP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return WI(t),n;if(e!==void 0)return VI(r),e},tP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>ql({error:t,command:T3,escapedCommand:T3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),T3="source.pipe(destination)"});var R3,I3=y(()=>{R3=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 vke}from"node:stream/promises";var P3,Ske,wke,xke,Sv,$ke,kke,C3=y(()=>{yv();Tb();_v();P3=(t,e,r)=>{let n=Sv.has(e)?wke(t,e):Ske(t,e);return Na(t,$ke,r.signal),Na(e,kke,r.signal),xke(e),n},Ske=(t,e)=>{let r=qa([t]);return Gl(r,e),Sv.set(e,r),r},wke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},xke=async t=>{try{await vke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,$ke=2,kke=1});import{aborted as Eke}from"node:util";var D3,Ake,N3=y(()=>{rP();D3=(t,e)=>t===void 0?[]:[Ake(t,e)],Ake=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Eke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw tP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,Tke,Oke,j3=y(()=>{bo();A3();rP();I3();C3();N3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=E3(t,...e),i=Tke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Tke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Oke(t,i);O3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=P3(e,o,d);return await Promise.race([R3(u),...D3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Oke=(t,e)=>Promise.allSettled([t,e])});import{on as Rke}from"node:events";import{getDefaultHighWaterMark as Ike}from"node:stream";var xv,Pke,nP,Cke,F3,iP,M3,Dke,Nke,$v=y(()=>{II();lv();DI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Pke(e,s),F3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Pke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},nP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Cke(e,s,t);let a=t.readableObjectMode&&!o;return F3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Cke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Rke(t,"data",{signal:e.signal,highWaterMark:M3,highWatermark:M3});return Dke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},iP=Ike(!0),M3=iP,Dke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Nke({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*hp(a)}},Nke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as jke}from"node:timers/promises";var L3,Mke,Fke,Lke,oP,z3,sP=y(()=>{Qb();an();jI();$v();La();mp();L3=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=Mke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Fke(t),d]);return}let f=TI(c,r),p=nP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Lke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Mke=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=nP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await DK(a,t,r,o)},Fke=async t=>{await jke(),t.readableFlowing===null&&t.resume()},Lke=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 z3(_W({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},oP=async t=>{try{return await t}catch(e){return z3(e)}},z3=({bufferedData:t})=>uZ(t)?new Uint8Array(t):t});import{finished as zke}from"node:stream/promises";var bp,Uke,qke,Hke,Bke,Gke,aP,kv,U3,Ev=y(()=>{bp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Uke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],zke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Bke(a,e,r,n)}finally{s.abort()}},Uke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&qke(t,r,n),n},qke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Hke(e,r),n.call(t,...i)}},Hke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Bke=(t,e,r,n)=>{if(!Gke(t,e,r,n))throw t},Gke=(t,e,r,n=!0)=>r.propagating?U3(t)||kv(t):(r.propagating=!0,aP(r,e)===n?U3(t):kv(t)),aP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",U3=t=>t?.code==="EPIPE"});var q3,cP,lP=y(()=>{sP();Ev();q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>cP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),cP=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(aP(l,e)){await u;return}let[d]=await Promise.all([L3({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 H3,B3,Zke,Vke,uP=y(()=>{yv();lP();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>cP({...Zke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Vke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Zke=({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}},Vke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var G3,Z3,V3=y(()=>{Pl();ps();G3=t=>Il(t,"ipc"),Z3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var W3,K3,J3=y(()=>{La();V3();xo();qI();W3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=G3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of UI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(bW(t,i,c),i.push(l)),s&&Z3(l,o);return i},K3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Wke}from"node:events";var Y3,Kke,Jke,Yke,X3=y(()=>{Fa();nI();WR();rI();So();$r();sP();J3();oI();uP();lP();LI();Ev();Y3=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 _=UK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=W3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Kke(h,t,S),D=Jke(m,S);try{return await Promise.race([Promise.all([{},HK(_),Promise.all(x),w,A,B9(t,d),...T,...D]),g,Yke(t,b),...L9(t,o,f,b),...o9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...M9({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=>oP(ae))),oP(w),K3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Kke=(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:Cn.has(i),stopOnExit:i==="native"}))),Yke=async(t,{signal:e})=>{let[r]=await Wke(t,"error",{signal:e});throw r}});var Q3,vp,Zl,Av=y(()=>{Fl();Q3=()=>({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}},Zl=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 eJ}from"node:stream/promises";var dP,tJ,fP,pP,Tv,Ov,mP=y(()=>{Ev();dP=async t=>{if(t!==void 0)try{await fP(t)}catch{}},tJ=async t=>{if(t!==void 0)try{await pP(t)}catch{}},fP=async t=>{await eJ(t,{cleanup:!0,readable:!1,writable:!0})},pP=async t=>{await eJ(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 Xke}from"node:stream";import{callbackify as Qke}from"node:util";var rJ,hP,gP,yP,eEe,_P,bP,nJ,vP=y(()=>{ja();hs();$v();Fl();Av();mP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=hP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=gP(a,s),{read:f,onStdoutDataDone:p}=yP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Xke({read:f,destroy:Qke(bP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _P({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},hP=(t,e,r)=>{let n=Ll(t,e),i=vp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},gP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:iP},yP=({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(){eEe(this,s,o)},onStdoutDataDone:o}},eEe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},_P=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await pP(t),await n,await dP(i),await e,r.readable&&r.push(null)}catch(o){await dP(i),nJ(r,o)}},bP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Zl(r,e)&&(nJ(t,n),await Tv(e,n))},nJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as tEe}from"node:stream";import{callbackify as iJ}from"node:util";var oJ,SP,wP,rEe,nEe,xP,$P,sJ,kP=y(()=>{hs();Av();mP();oJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=SP(t,r,e),s=new tEe({...wP(n,t,i),destroy:iJ($P.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xP(n,s),s},SP=(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}},wP=(t,e,r)=>({write:rEe.bind(void 0,t),final:iJ(nEe.bind(void 0,t,e,r))}),rEe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},nEe=async(t,e,r)=>{await Zl(r,e)&&(t.writable&&t.end(),await e)},xP=async(t,e,r)=>{try{await fP(t),e.writable&&e.end()}catch(n){await tJ(r),sJ(e,n)}},$P=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Zl(r,e),await Zl(n,e)&&(sJ(t,i),await Tv(e,i))},sJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as iEe}from"node:stream";import{callbackify as oEe}from"node:util";var aJ,sEe,cJ=y(()=>{ja();vP();kP();aJ=({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}=hP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=SP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=gP(c,a),{read:g,onStdoutDataDone:b}=yP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new iEe({read:g,...wP(u,t,d),destroy:oEe(sEe.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 _P({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),xP(u,_,c),_},sEe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([bP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),$P({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var EP,aEe,lJ=y(()=>{ja();hs();$v();EP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ll(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return aEe(a,s,t)},aEe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var uJ,dJ=y(()=>{Av();vP();kP();cJ();lJ();uJ=(t,{encoding:e})=>{let r=Q3();t.readable=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=oJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=aJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=EP.bind(void 0,t,e),t[Symbol.asyncIterator]=EP.bind(void 0,t,e,{})}});var fJ,cEe,lEe,pJ=y(()=>{fJ=(t,e)=>{for(let[r,n]of lEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},cEe=(async()=>{})().constructor.prototype,lEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(cEe,t)])});import{setMaxListeners as uEe}from"node:events";import{spawn as dEe}from"node:child_process";var mJ,fEe,pEe,mEe,hEe,gEe,hJ=y(()=>{Qb();DR();cI();hs();lI();HI();pp();rv();i3();l3();mp();b3();xb();$3();j3();uP();X3();dJ();Fl();pJ();mJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=fEe(t,e,r),{subprocess:f,promise:p}=mEe({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}),fJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},fEe=(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=pEe(l),d=c3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},pEe=({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}},mEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=dEe(...Bb(t,e,r))}catch(m){return n3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;uEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_3(c,a,l),x3(c,r,l);let d={},f=Di();c.kill=n9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),uJ(c,r),e3(c,r);let p=hEe({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}},hEe=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 Y3({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=gEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Hl(S,n,e)},gEe=({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,yEe,_Ee,gJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,yEe(n,t[n],i)]));return{...t,...r}},yEe=(t,e,r)=>_Ee.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,_Ee=new Set(["env",...OR])});var _s,bEe,vEe,yJ=y(()=>{bo();$R();_Z();VK();hJ();gJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>bEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},bEe=({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}=vEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ZK(a,c,l):mJ(a,c,l,i)},vEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=gZ(e)?yZ(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 _J,bJ,vJ,SEe,wEe,SJ=y(()=>{_J=({file:t,commandArguments:e})=>vJ(t,e),bJ=({file:t,commandArguments:e})=>({...vJ(t,e),isSync:!0}),vJ=(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]=SEe(t);return{file:r,commandArguments:n}},SEe=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(wEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},wEe=/ +/g});var wJ,xJ,xEe,$J,$Ee,kJ,EJ=y(()=>{wJ=(t,e,r)=>{t.sync=e(xEe,r),t.s=t.sync},xJ=({options:t})=>$J(t),xEe=({options:t})=>({...$J(t),isSync:!0}),$J=t=>({options:{...$Ee(t),...t}}),$Ee=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kJ={preferLocal:!0}});var Ydt,Ke,Xdt,Qdt,eft,tft,rft,nft,ift,oft,zr=y(()=>{yJ();SJ();iI();EJ();HI();Ydt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),Xdt=_s(_J),Qdt=_s(bJ),eft=_s(U9),tft=_s(xJ,{},kJ,wJ),{sendMessage:rft,getOneMessage:nft,getEachMessage:ift,getCancelSignal:oft}=t3()});import{existsSync as Iv,statSync as kEe}from"node:fs";import{dirname as AP,extname as EEe,isAbsolute as AJ,join as TP,relative as OP,resolve as Pv,sep as AEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function TEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function OEe(t,e){let n=OP(t,e).split(AEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function REe(t,e){let r=Pv(t,e),n=r;Iv(r)?kEe(r).isFile()&&(n=AP(r)):EEe(r)!==""&&(n=AP(r));let i=OP(t,n);if(i.startsWith("..")||AJ(i))return null;let o=n;for(;;){if(TEe(o))return o;if(Pv(o)===Pv(t))return null;let s=AP(o);if(s===o)return null;let a=OP(t,s);if(a.startsWith("..")||AJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=REe(r,o);if(!s){i.push(o);continue}let a=OEe(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 IP,readFileSync as IEe}from"node:fs";import{join as Vl}from"node:path";function Wl(t="."){let e=Vl(t,".cladding","config.yaml");if(!IP(e))return RP;try{let n=(0,TJ.parse)(IEe(e,"utf8"))?.gate;if(!n)return RP;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 PEe){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 RP}}function OJ(t="."){let e=Wl(t).testReport,r=e?[e,...PP]:PP;return[...new Set(r.map(n=>Vl(t,n)))]}function RJ(t="."){let e=Wl(t).testReport;if(e){let r=Vl(t,e);return IP(r)?r:null}return PP.map(r=>Vl(t,r)).find(r=>IP(r))??null}function IJ(t,e){let r=[],n=!1;for(let i of t){let o=CEe.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 TJ,PEe,RP,PP,CEe,Sp=y(()=>{"use strict";TJ=wt(tr(),1);Nv();PEe=["type","lint","test","coverage"],RP={scope:"feature"},PP=["test-report.junit.xml",Vl("coverage","junit.xml"),Vl(".cladding","test-report.junit.xml")];CEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as DP,readFileSync as PJ,readdirSync as DEe,statSync as NEe}from"node:fs";import{join as jv}from"node:path";function MP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(DP(r))try{if(CJ.test(PJ(r,"utf8")))return!0}catch{}}return!1}function DJ(t){try{return DP(t)&&CJ.test(PJ(t,"utf8"))}catch{return!1}}function NJ(t,e=0){if(e>4||!DP(t))return!1;let r;try{r=DEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=NEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DJ(i))return!0}return!1}function FEe(t){if(MP(t))return!0;for(let e of jEe)if(DJ(jv(t,e)))return!0;for(let e of MEe)if(NJ(jv(t,e)))return!0;return!1}function jJ(t="."){let e=Wl(t).coverage;return e||(FEe(t)?"kover":"jacoco")}function MJ(t="."){return NP[jJ(t)]}function FJ(t="."){return CP[jJ(t)]}var NP,CP,jP,CJ,jEe,MEe,Mv=y(()=>{"use strict";Sp();NP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},CP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},jP=[CP.kover,CP.jacoco],CJ=/kover/i;jEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],MEe=["buildSrc","build-logic"]});import{existsSync as xp,readFileSync as LP,readdirSync as zJ,statSync as LEe}from"node:fs";import{dirname as zEe,join as kr,resolve as UEe}from"node:path";import Kl from"node:process";function zP(t){return xp(kr(t,"gradlew"))?"./gradlew":"gradle"}function qEe(t){let e=zP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function HEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LP(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 GEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function WEe(t,e){for(let r of e)if(xp(kr(t,r)))return r}function KEe(t,e){try{return zJ(t).find(n=>n.endsWith(e))}catch{return}}function QEe(t){let e=[],r=Kl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Kl.env.USERPROFILE:Kl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=UEe(t);;){e.push(kr(o,".madgerc"));let s=zEe(o);if(s===o)break;o=s}let i=Kl.env.MADGE_config??Kl.env.madge_config;return i&&e.push(i),e}function eAe(){for(let[t,e]of Object.entries(Kl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function UJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function rAe(t){try{return LEe(t).isFile()}catch{return!1}}function nAe(t){let e;try{e=LP(t,"utf8")}catch{return!0}try{return UJ(JSON.parse(e).excludeRegExp)}catch{return tAe.test(e)}}function iAe(t,e){let r=e.madge;return r&&typeof r=="object"&&UJ(r.excludeRegExp)||eAe()?!0:QEe(t).some(n=>rAe(n)&&nAe(n))}function oAe(t){try{return JSON.parse(LP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function wp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function LJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function sAe(t,e,r){if(iAe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",XEe),{...e,args:n}}function aAe(t,e,r){if(wp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of JEe)if(n.configs.some(i=>xp(kr(t,i))))return n.gate;if(YEe.some(n=>xp(kr(t,n)))||r.eslintConfig!==void 0)return e}function lAe(t,e){return cAe.some(r=>xp(kr(t,r)))?!0:e.jest!==void 0}function uAe(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 FP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function dAe(t,e){let r=oAe(t),n=e.lint?aAe(t,e.lint,r):void 0,i=e.arch?{...e,arch:sAe(t,e.arch,r)}:e,o=n?{...i,lint:n}:FP(i,"lint"),s=wp(r,"test"),a=s?uAe(s):void 0;return s&&!a?(o=FP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...wp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&lAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!wp(r,"coverage")&&!LJ(r,"@vitest/coverage-v8")&&!LJ(r,"@vitest/coverage-istanbul")?o=FP(o,"coverage"):a==="vitest"&&wp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of ZEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=KEe(t,o):r=WEe(t,[o]),r)break;if(!r||e.requiresSource&&!GEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?dAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return VEe}var Fi,BEe,ZEe,VEe,JEe,YEe,XEe,tAe,cAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];BEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);ZEe=[{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:qEe},{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:HEe}],VEe={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"]}}],YEe=["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"],XEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";tAe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;cAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as fAe,readFileSync as pAe}from"node:fs";import{join as mAe}from"node:path";function Ba(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 qJ.test(o)||qJ.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??"")} ${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 Kl(t,e){let r=sAe(t,"package.json");if(!iAe(r))return!1;try{return!!JSON.parse(oAe(r,"utf8")).scripts?.[e]}catch{return!1}}var UJ,Nn=y(()=>{"use strict";UJ=/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 aAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:aAe}});function cAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:cAe}});import{existsSync as UP,readdirSync as qJ}from"node:fs";import{join as Hv}from"node:path";function uAe(t,e){let r=Hv(t,e.path);if(!UP(r))return!0;if(e.isDirectory)try{return qJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function dAe(t){let{cwd:e="."}=t,r=[];for(let i of lAe)uAe(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(UP(n)){let i=mAe(n),o=i?null:fAe(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=pAe(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 fAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!UP(r))continue;let n;try{n=qJ(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 pAe(t){try{return q(t),null}catch(e){return e.message}}function mAe(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,lAe,HJ,BJ=y(()=>{"use strict";Ue();V_();xp="ABSENCE_OF_GOVERNANCE",lAe=[{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}];HJ={name:xp,run:dAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function qP(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=gAe.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=hAe[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 yAe(t,e){let r=qP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function GJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...yAe(r,n));return e}var hAe,gAe,HP=y(()=>{"use strict";hAe={event:"when",state:"while",optional:"where",unwanted:"if"},gAe=/\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 _Ae(t){let{cwd:e="."}=t;return ye(e,Gv,bAe)}function bAe(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 GJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,ZJ,VJ=y(()=>{"use strict";HP();xt();Gv="AC_DRIFT";ZJ={name:Gv,run:_Ae}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return KJ[n]??WJ}var vAe,SAe,wAe,WJ,xAe,$Ae,KJ,kAe,JJ,Va=y(()=>{"use strict";Dn();vAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,SAe=/^[ \t]*import\s+([\w.]+)/gm,wAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,WJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:vAe,importStyle:"relative"},xAe={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:SAe,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:wAe,importStyle:"dotted"},KJ={typescript:WJ,kotlin:xAe,python:$Ae},kAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],JJ=new Set([...Object.values(KJ).flatMap(t=>t?.extensions??[]),...kAe].map(t=>t.toLowerCase()))});import{existsSync as EAe,readFileSync as AAe,readdirSync as TAe,statSync as OAe}from"node:fs";import{join as XJ,relative as YJ}from"node:path";function RAe(t,e){if(!EAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=TAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=XJ(i,s),c;try{c=OAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function IAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function CAe(t){return PAe.test(t)}function DAe(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=>RAe(XJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=AAe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Va();QJ="AI_HINTS_FORBIDDEN_PATTERN";PAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;e8={name:QJ,run:DAe}});function NAe(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:r8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var r8,n8,i8=y(()=>{"use strict";Ue();r8="AC_DUPLICATE_WITHIN_FEATURE";n8={name:r8,run:NAe}});import{createRequire as jAe}from"module";import{basename as MAe,dirname as GP,normalize as FAe,relative as LAe,resolve as zAe,sep as a8}from"path";import*as UAe from"fs";function qAe(t){let e=FAe(t);return e.length>1&&e[e.length-1]===a8&&(e=e.substring(0,e.length-1)),e}function c8(t,e){return t.replace(HAe,e)}function GAe(t){return t==="/"||BAe.test(t)}function BP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=zAe(t)),(n||o)&&(t=qAe(t)),t===".")return"";let s=t[t.length-1]!==i;return c8(s?t+i:t,i)}function l8(t,e){return e+t}function ZAe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:c8(LAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function VAe(t){return t}function WAe(t,e,r){return e+t+r}function KAe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?ZAe(t,e):n?l8:VAe}function JAe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function YAe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function tTe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?YAe(t):JAe(t):n&&n.length?QAe:XAe:eTe}function aTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?sTe:r&&r.length?n?rTe:nTe:n?iTe:oTe}function uTe(t){return t.group?lTe:cTe}function pTe(t){return t.group?dTe:fTe}function gTe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?hTe:mTe}function u8(t,e,r){if(r.options.useRealPaths)return yTe(e,r);let n=GP(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=GP(n)}return r.symlinks.set(t,e),i>1}function yTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function ETe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?_Te:wTe:n?e?bTe:kTe:i?e?STe:$Te:e?vTe:xTe}function OTe(t){return t?TTe:ATe}function CTe(t,e){return new Promise((r,n)=>{p8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function p8(t,e,r){new f8(t,e,r).start()}function DTe(t,e){return new f8(t,e).start()}var o8,HAe,BAe,XAe,QAe,eTe,rTe,nTe,iTe,oTe,sTe,cTe,lTe,dTe,fTe,mTe,hTe,_Te,bTe,vTe,STe,wTe,xTe,$Te,kTe,d8,ATe,TTe,RTe,ITe,PTe,f8,s8,m8,h8,g8=y(()=>{o8=jAe(import.meta.url);HAe=/[\\/]/g;BAe=/^[a-z]:[\\/]$/i;XAe=(t,e)=>{e.push(t||".")},QAe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},eTe=()=>{};rTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},nTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},iTe=(t,e,r,n)=>{r.files++},oTe=(t,e)=>{e.push(t)},sTe=()=>{};cTe=t=>t,lTe=()=>[""].slice(0,0);dTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},fTe=()=>{};mTe=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()&&u8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},hTe=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()&&u8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};_Te=t=>t.counts,bTe=t=>t.groups,vTe=t=>t.paths,STe=t=>t.paths.slice(0,t.options.maxFiles),wTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),xTe=(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),kTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);d8={withFileTypes:!0},ATe=(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||".",d8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},TTe=(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||".",d8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};RTe=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))}},ITe=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}},PTe=class{aborted=!1;abort(){this.aborted=!0}},f8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=ETe(e,this.isSynchronous),this.root=BP(t,e),this.state={root:GAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new ITe,options:e,queue:new RTe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new PTe,fs:e.fs||UAe},this.joinPath=KAe(this.root,e),this.pushDirectory=tTe(this.root,e),this.pushFile=aTe(e),this.getArray=uTe(e),this.groupFiles=pTe(e),this.resolveSymlink=gTe(e,this.isSynchronous),this.walkDirectory=OTe(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(_=BP(_,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=MAe(_),x=BP(GP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};s8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return CTe(this.root,this.options)}withCallback(t){p8(this.root,this.options,t)}sync(){return DTe(this.root,this.options)}},m8=null;try{o8.resolve("picomatch"),m8=o8("picomatch")}catch{}h8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:a8,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 s8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new s8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||m8;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((Yft,S8)=>{"use strict";var y8="[^\\\\/]",NTe="(?=.)",_8="[^/]",ZP="(?:\\/|$)",b8="(?:^|\\/)",VP=`\\.{1,2}${ZP}`,jTe="(?!\\.)",MTe=`(?!${b8}${VP})`,FTe=`(?!\\.{0,1}${ZP})`,LTe=`(?!${VP})`,zTe="[^.\\/]",UTe=`${_8}*?`,qTe="/",v8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:NTe,QMARK:_8,END_ANCHOR:ZP,DOTS_SLASH:VP,NO_DOT:jTe,NO_DOTS:MTe,NO_DOT_SLASH:FTe,NO_DOTS_SLASH:LTe,QMARK_NO_DOT:zTe,STAR:UTe,START_ANCHOR:b8,SEP:qTe},HTe={...v8,SLASH_LITERAL:"[\\\\/]",QMARK:y8,STAR:`${y8}*?`,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:"\\"},BTe={__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"};S8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:BTe,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?HTe:v8}}});var kp=v(Ur=>{"use strict";var{REGEX_BACKSLASH:GTe,REGEX_REMOVE_BACKSLASH:ZTe,REGEX_SPECIAL_CHARS:VTe,REGEX_SPECIAL_CHARS_GLOBAL:WTe}=$p();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>VTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(WTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(GTe,"/");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 O8=v((Qft,T8)=>{"use strict";var w8=kp(),{CHAR_ASTERISK:WP,CHAR_AT:KTe,CHAR_BACKWARD_SLASH:Ep,CHAR_COMMA:JTe,CHAR_DOT:KP,CHAR_EXCLAMATION_MARK:JP,CHAR_FORWARD_SLASH:A8,CHAR_LEFT_CURLY_BRACE:YP,CHAR_LEFT_PARENTHESES:XP,CHAR_LEFT_SQUARE_BRACKET:YTe,CHAR_PLUS:XTe,CHAR_QUESTION_MARK:x8,CHAR_RIGHT_CURLY_BRACE:QTe,CHAR_RIGHT_PARENTHESES:$8,CHAR_RIGHT_SQUARE_BRACKET:eOe}=$p(),k8=t=>t===A8||t===Ep,E8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},tOe=(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&&k8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=w8.removeBackslashes(C)),J&&_===!0&&(J=w8.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,k8(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(),ln=kp(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:rOe,REGEX_NON_SPECIAL_CHARS:nOe,REGEX_SPECIAL_CHARS_BACKREF:iOe,REPLACEMENTS:R8}=Ap,oOe=(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=>ln.escapeRegex(i)).join("..")}return r},Jl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,I8=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},sOe=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},eC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(sOe(e))return e.replace(/\\(.)/g,"$1")},aOe=t=>{let e=t.map(eC).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}}}}},cOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,lOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=eC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},uOe=t=>{let e=0,r=t.trim(),n=QP(r);for(;n;)e++,r=n.body.trim(),n=QP(r);return e},dOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Ap.DEFAULT_MAX_EXTGLOB_RECURSION,n=I8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||aOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=lOe(a);if(c){o=!0,i.push(...c);continue}let l=eC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,uOe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:cOe([...new Set(i)])}:{risky:!0}:{risky:!1}},tC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=R8[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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Afe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=dOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=tC(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,ht=t.replace(iOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=rOe[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=ln.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){Afe(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||ln.hasRegexChars(B))continue;let Oe=ln.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=oOe(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=nOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Jl("closing","}"));E.output=ln.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};tC.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=R8[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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};P8.exports=tC});var j8=v((tpt,N8)=>{"use strict";var fOe=O8(),rC=C8(),D8=kp(),pOe=$p(),mOe=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=mOe(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?D8.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(D8.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)):rC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>fOe(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=rC.fastpaths(t,e)),i.output||(i=rC(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=pOe;N8.exports=Rt});var z8=v((rpt,L8)=>{"use strict";var M8=j8(),hOe=kp();function F8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:hOe.isWindows()}),M8(t,e,r)}Object.assign(F8,M8);L8.exports=F8});import{readdir as gOe,readdirSync as yOe,realpath as _Oe,realpathSync as bOe,stat as vOe,statSync as SOe}from"fs";import{isAbsolute as wOe,posix as Wa,resolve as xOe}from"path";import{fileURLToPath as $Oe}from"url";function TOe(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]===".."&&AOe.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 IOe(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 q8(t){return t.replace(EOe,e=>`${e}/`)}function Z8(t){var e;let r=Yl.default.scan(t,POe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function FOe(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 V8(t){return typeof t=="string"?[t]:t??[]}function nC(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=MOe(o);s=wOe(s.replace(zOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=LOe.exec(s))===null||i===void 0?void 0:i[0],l=Z8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=q8(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 UOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(nC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(nC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(nC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function qOe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=UOe(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(B8,""),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=TOe(i.match,f),g=U8(r,d,o),b=o?g:U8(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 h8({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&&IOe(r,d)]}function HOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function BOe(t){let e=Object.assign({},t);for(let r in H8)e[r]===void 0&&Object.assign(e,{[r]:H8[r]});return e.cwd=(e.cwd instanceof URL?$Oe(e.cwd):xOe(e.cwd||process.cwd())).replace(B8,"/"),e.ignore=V8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||gOe,readdirSync:e.fs.readdirSync||yOe,realpath:e.fs.realpath||_Oe,realpathSync:e.fs.realpathSync||bOe,stat:e.fs.stat||vOe,statSync:e.fs.statSync||SOe}),e.debug&&Tp("globbing with options:",e),e}function GOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=kOe(t)||typeof t=="string",i=V8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=BOe(n?e:t);return i.length>0?qOe(o,i):[]}function vs(t,e){let[r,n]=GOe(t,e);return r?HOe(r.sync(),n):[]}var Yl,kOe,B8,EOe,G8,AOe,OOe,ROe,POe,COe,DOe,NOe,jOe,MOe,LOe,zOe,H8,Op=y(()=>{g8();Yl=wt(z8(),1),kOe=Array.isArray,B8=/\\/g,EOe=/^[A-Za-z]:$/,G8=process.platform==="win32",AOe=/^(\/?\.\.)+$/;OOe=/^[A-Z]:\/$/i,ROe=G8?t=>OOe.test(t):t=>t==="/";POe={parts:!0};COe=/(?t.replace(COe,"\\$&"),jOe=t=>t.replace(DOe,"\\$&"),MOe=G8?jOe:NOe;LOe=/^(\/?\.\.)+/,zOe=/\\(?=[()[\]{}!*+?@|])/g;H8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Rp,readFileSync as ZOe,readdirSync as VOe,statSync as W8}from"node:fs";import{join as Ka}from"node:path";function WOe(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}=iC(r);return(s.size>0||a.length>0)&&!Rp(Ka(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&&(KOe(e,i,s,o),JOe(e,i,s,o)),a.length>0&&YOe(e,i,a,o),o)}function iC(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 KOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of VOe(o)){let a=Ka(o,s);W8(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 JOe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Rp(o))for(let s of r){let a=Ka(o,s);Rp(a)&&W8(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 YOe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Rp(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];XOe(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 XOe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Ip,K8,oC=y(()=>{"use strict";Op();Ue();Va();Ip="ARCHITECTURE_FROM_SPEC";K8={name:Ip,run:WOe}});import{existsSync as QOe,readFileSync as eRe}from"node:fs";import{join as tRe}from"node:path";function nRe(t){let{cwd:e="."}=t,r=tRe(e,"spec/capabilities.yaml");if(!QOe(r))return[];let n;try{let u=eRe(r,"utf8"),d=J8.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";J8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",rRe=8;Y8={name:Wv,run:nRe}});import{existsSync as iRe,readFileSync as oRe}from"node:fs";import{join as sRe}from"node:path";function aRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function cRe(t){let{cwd:e="."}=t;return ye(e,sC,r=>lRe(r,e))}function lRe(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=sRe(e,o);if(!iRe(s))continue;let a=oRe(s,"utf8");aRe(a)||n.push({detector:sC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var sC,Q8,e5=y(()=>{"use strict";Va();xt();sC="CONVENTION_DRIFT";Q8={name:sC,run:cRe}});import{existsSync as aC,readFileSync as t5}from"node:fs";import{join as Kv}from"node:path";function uRe(t){return JSON.parse(t).total?.lines?.pct??0}function r5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function pRe(t,e){if(!Cv(_t(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=jP.find(d=>aC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=r5(t5(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=n5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function mRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=pRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?jP.find(a=>aC(Kv(e,a)))??MJ(e):n.coverageSummary,o=Kv(e,i);if(!aC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=t5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?dRe(a):n.coverageFormat==="cobertura-xml"?fRe(a):uRe(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,i5,o5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;i5={name:Eo,run:mRe}});import{existsSync as hRe}from"node:fs";import{join as gRe}from"node:path";function _Re(t){let{cwd:e="."}=t;return ye(e,Yv,r=>bRe(r,e))}function bRe(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",yRe=8;s5={name:Yv,run:_Re}});function vRe(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 SRe(t){let e=vRe(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 wRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>SRe(r))}var Xv,c5,l5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";c5={name:Xv,run:wRe}});function xRe(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,cC=y(()=>{"use strict";kl();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:xRe}});function kRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return ERe(r)}function ERe(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:u5,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 u5,tS,lC=y(()=>{"use strict";Ue();u5="DEPENDENCY_CYCLE";tS={name:u5,run:kRe}});import{appendFileSync as ARe,existsSync as d5,mkdirSync as TRe,readFileSync as ORe}from"node:fs";import{dirname as RRe,join as IRe}from"node:path";function f5(t){return IRe(t,PRe,CRe)}function p5(t){return uC.add(t),()=>uC.delete(t)}function Ja(t,e){let r=f5(t),n=RRe(r);d5(n)||TRe(n,{recursive:!0}),ARe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of uC)try{i(t,e)}catch{}}function pr(t){let e=f5(t);if(!d5(e))return[];let r=ORe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var PRe,CRe,uC,un=y(()=>{"use strict";PRe=".cladding",CRe="audit.log.jsonl";uC=new Set});import{existsSync as DRe}from"node:fs";import{join as NRe}from"node:path";function jRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:dC,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&&(DRe(NRe(e,i.artifact))||n.push({detector:dC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var dC,m5,h5=y(()=>{"use strict";un();dC="EVIDENCE_MISMATCH";m5={name:dC,run:jRe}});import{existsSync as MRe,readFileSync as FRe}from"node:fs";import{join as LRe}from"node:path";function zRe(t){let e=LRe(t,b5);if(!MRe(e))return null;try{let n=((0,_5.parse)(FRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*y5(t,e){for(let r of t??[])r.startsWith(g5)&&(yield{ref:r,name:r.slice(g5.length),field:e})}function URe(t){let{cwd:e="."}=t,r=zRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:fC,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=[...y5(s.evidence_refs,"evidence_refs"),...y5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:fC,severity:"warn",path:b5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var _5,fC,g5,b5,v5,S5=y(()=>{"use strict";_5=wt(tr(),1);Ue();fC="FIXTURE_REFERENCE_INVALID",g5="fixture:",b5="conformance/fixtures.yaml";v5={name:fC,run:URe}});import{existsSync as Xl,readFileSync as pC}from"node:fs";import{join as Ya}from"node:path";function qRe(t){return vs(["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(pC(t,"utf8"))}catch{return null}}function HRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(pC(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=qRe(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 BRe(t,e){for(let r of w5){let n=Ya(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 GRe(t,e){let r=Pp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of w5){let s=Ya(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=Ya(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 VRe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Xl(r)||!Xl(n))return;let i=ZRe(pC(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 WRe(t){let{cwd:e="."}=t,r=[];return HRe(e,r),VRe(e,r),BRe(e,r),GRe(e,r),r}var Ao,w5,x5,$5=y(()=>{"use strict";Op();Ao="HARNESS_INTEGRITY",w5=[{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"]}];x5={name:Ao,run:WRe}});import{existsSync as KRe,readFileSync as JRe}from"node:fs";import{join as YRe}from"node:path";function QRe(t){let{cwd:e="."}=t;return ye(e,rS,r=>tIe(r,e))}function eIe(t){let e=YRe(t,"spec/capabilities.yaml");if(!KRe(e))return!1;try{let r=k5.default.parse(JRe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function tIe(t,e){let r=t.features.length;if(r{"use strict";k5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",XRe=8;E5={name:rS,run:QRe}});function rIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function nIe(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+=` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Jl(t,e){let r=mAe(t,"package.json");if(!fAe(r))return!1;try{return!!JSON.parse(pAe(r,"utf8")).scripts?.[e]}catch{return!1}}var qJ,Nn=y(()=>{"use strict";qJ=/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 hAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:hAe}});function gAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:gAe}});import{existsSync as UP,readdirSync as HJ}from"node:fs";import{join as Hv}from"node:path";function _Ae(t,e){let r=Hv(t,e.path);if(!UP(r))return!0;if(e.isDirectory)try{return HJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function bAe(t){let{cwd:e="."}=t,r=[];for(let i of yAe)_Ae(e,i)&&r.push({detector:$p,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(UP(n)){let i=wAe(n),o=i?null:vAe(e);if(i)r.push({detector:$p,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:$p,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=SAe(e);s&&r.push({detector:$p,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 vAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!UP(r))continue;let n;try{n=HJ(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 SAe(t){try{return q(t),null}catch(e){return e.message}}function wAe(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 $p,yAe,BJ,GJ=y(()=>{"use strict";Ue();V_();$p="ABSENCE_OF_GOVERNANCE",yAe=[{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}];BJ={name:$p,run:bAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function qP(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=$Ae.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=xAe[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 kAe(t,e){let r=qP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function ZJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...kAe(r,n));return e}var xAe,$Ae,HP=y(()=>{"use strict";xAe={event:"when",state:"while",optional:"where",unwanted:"if"},$Ae=/\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 EAe(t){let{cwd:e="."}=t;return ye(e,Gv,AAe)}function AAe(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 ZJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,VJ,WJ=y(()=>{"use strict";HP();xt();Gv="AC_DRIFT";VJ={name:Gv,run:EAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return JJ[n]??KJ}var TAe,OAe,RAe,KJ,IAe,PAe,JJ,CAe,YJ,Va=y(()=>{"use strict";Dn();TAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,OAe=/^[ \t]*import\s+([\w.]+)/gm,RAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,KJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:TAe,importStyle:"relative"},IAe={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:OAe,importStyle:"dotted"},PAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:RAe,importStyle:"dotted"},JJ={typescript:KJ,kotlin:IAe,python:PAe},CAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],YJ=new Set([...Object.values(JJ).flatMap(t=>t?.extensions??[]),...CAe].map(t=>t.toLowerCase()))});import{existsSync as DAe,readFileSync as NAe,readdirSync as jAe,statSync as MAe}from"node:fs";import{join as QJ,relative as XJ}from"node:path";function FAe(t,e){if(!DAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=jAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=QJ(i,s),c;try{c=MAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function LAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function UAe(t){return zAe.test(t)}function qAe(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=>FAe(QJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=NAe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Va();e8="AI_HINTS_FORBIDDEN_PATTERN";zAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;t8={name:e8,run:qAe}});function HAe(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:n8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var n8,i8,o8=y(()=>{"use strict";Ue();n8="AC_DUPLICATE_WITHIN_FEATURE";i8={name:n8,run:HAe}});import{createRequire as BAe}from"module";import{basename as GAe,dirname as GP,normalize as ZAe,relative as VAe,resolve as WAe,sep as c8}from"path";import*as KAe from"fs";function JAe(t){let e=ZAe(t);return e.length>1&&e[e.length-1]===c8&&(e=e.substring(0,e.length-1)),e}function l8(t,e){return t.replace(YAe,e)}function QAe(t){return t==="/"||XAe.test(t)}function BP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=WAe(t)),(n||o)&&(t=JAe(t)),t===".")return"";let s=t[t.length-1]!==i;return l8(s?t+i:t,i)}function u8(t,e){return e+t}function eTe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:l8(VAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function tTe(t){return t}function rTe(t,e,r){return e+t+r}function nTe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?eTe(t,e):n?u8:tTe}function iTe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function oTe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function lTe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?oTe(t):iTe(t):n&&n.length?aTe:sTe:cTe}function hTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?mTe:r&&r.length?n?uTe:dTe:n?fTe:pTe}function _Te(t){return t.group?yTe:gTe}function STe(t){return t.group?bTe:vTe}function $Te(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?xTe:wTe}function d8(t,e,r){if(r.options.useRealPaths)return kTe(e,r);let n=GP(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=GP(n)}return r.symlinks.set(t,e),i>1}function kTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function DTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?ETe:RTe:n?e?ATe:CTe:i?e?OTe:PTe:e?TTe:ITe}function MTe(t){return t?jTe:NTe}function UTe(t,e){return new Promise((r,n)=>{m8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function m8(t,e,r){new p8(t,e,r).start()}function qTe(t,e){return new p8(t,e).start()}var s8,YAe,XAe,sTe,aTe,cTe,uTe,dTe,fTe,pTe,mTe,gTe,yTe,bTe,vTe,wTe,xTe,ETe,ATe,TTe,OTe,RTe,ITe,PTe,CTe,f8,NTe,jTe,FTe,LTe,zTe,p8,a8,h8,g8,y8=y(()=>{s8=BAe(import.meta.url);YAe=/[\\/]/g;XAe=/^[a-z]:[\\/]$/i;sTe=(t,e)=>{e.push(t||".")},aTe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},cTe=()=>{};uTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},dTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},fTe=(t,e,r,n)=>{r.files++},pTe=(t,e)=>{e.push(t)},mTe=()=>{};gTe=t=>t,yTe=()=>[""].slice(0,0);bTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},vTe=()=>{};wTe=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()&&d8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},xTe=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()&&d8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};ETe=t=>t.counts,ATe=t=>t.groups,TTe=t=>t.paths,OTe=t=>t.paths.slice(0,t.options.maxFiles),RTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),ITe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),PTe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),CTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);f8={withFileTypes:!0},NTe=(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||".",f8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},jTe=(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||".",f8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};FTe=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))}},LTe=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}},zTe=class{aborted=!1;abort(){this.aborted=!0}},p8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=DTe(e,this.isSynchronous),this.root=BP(t,e),this.state={root:QAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LTe,options:e,queue:new FTe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new zTe,fs:e.fs||KAe},this.joinPath=nTe(this.root,e),this.pushDirectory=lTe(this.root,e),this.pushFile=hTe(e),this.getArray=_Te(e),this.groupFiles=STe(e),this.resolveSymlink=$Te(e,this.isSynchronous),this.walkDirectory=MTe(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(_=BP(_,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=GAe(_),x=BP(GP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};a8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return UTe(this.root,this.options)}withCallback(t){m8(this.root,this.options,t)}sync(){return qTe(this.root,this.options)}},h8=null;try{s8.resolve("picomatch"),h8=s8("picomatch")}catch{}g8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:c8,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 a8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new a8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||h8;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 kp=v((lpt,w8)=>{"use strict";var _8="[^\\\\/]",HTe="(?=.)",b8="[^/]",ZP="(?:\\/|$)",v8="(?:^|\\/)",VP=`\\.{1,2}${ZP}`,BTe="(?!\\.)",GTe=`(?!${v8}${VP})`,ZTe=`(?!\\.{0,1}${ZP})`,VTe=`(?!${VP})`,WTe="[^.\\/]",KTe=`${b8}*?`,JTe="/",S8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:HTe,QMARK:b8,END_ANCHOR:ZP,DOTS_SLASH:VP,NO_DOT:BTe,NO_DOTS:GTe,NO_DOT_SLASH:ZTe,NO_DOTS_SLASH:VTe,QMARK_NO_DOT:WTe,STAR:KTe,START_ANCHOR:v8,SEP:JTe},YTe={...S8,SLASH_LITERAL:"[\\\\/]",QMARK:_8,STAR:`${_8}*?`,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:"\\"},XTe={__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"};w8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:XTe,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?YTe:S8}}});var Ep=v(Ur=>{"use strict";var{REGEX_BACKSLASH:QTe,REGEX_REMOVE_BACKSLASH:eOe,REGEX_SPECIAL_CHARS:tOe,REGEX_SPECIAL_CHARS_GLOBAL:rOe}=kp();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>tOe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(rOe,"\\$1");Ur.toPosixSlashes=t=>t.replace(QTe,"/");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(eOe,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 R8=v((dpt,O8)=>{"use strict";var x8=Ep(),{CHAR_ASTERISK:WP,CHAR_AT:nOe,CHAR_BACKWARD_SLASH:Ap,CHAR_COMMA:iOe,CHAR_DOT:KP,CHAR_EXCLAMATION_MARK:JP,CHAR_FORWARD_SLASH:T8,CHAR_LEFT_CURLY_BRACE:YP,CHAR_LEFT_PARENTHESES:XP,CHAR_LEFT_SQUARE_BRACKET:oOe,CHAR_PLUS:sOe,CHAR_QUESTION_MARK:$8,CHAR_RIGHT_CURLY_BRACE:aOe,CHAR_RIGHT_PARENTHESES:k8,CHAR_RIGHT_SQUARE_BRACKET:cOe}=kp(),E8=t=>t===T8||t===Ap,A8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},lOe=(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&&E8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=x8.removeBackslashes(C)),J&&_===!0&&(J=x8.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,E8(T)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Tp=kp(),ln=Ep(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:uOe,REGEX_NON_SPECIAL_CHARS:dOe,REGEX_SPECIAL_CHARS_BACKREF:fOe,REPLACEMENTS:I8}=Tp,pOe=(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=>ln.escapeRegex(i)).join("..")}return r},Yl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,P8=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},mOe=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},eC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(mOe(e))return e.replace(/\\(.)/g,"$1")},hOe=t=>{let e=t.map(eC).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}}}}},gOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,yOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=eC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},_Oe=t=>{let e=0,r=t.trim(),n=QP(r);for(;n;)e++,r=n.body.trim(),n=QP(r);return e},bOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Tp.DEFAULT_MAX_EXTGLOB_RECURSION,n=P8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||hOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=yOe(a);if(c){o=!0,i.push(...c);continue}let l=eC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,_Oe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:gOe([...new Set(i)])}:{risky:!0}:{risky:!1}},tC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=I8[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=Tp.globChars(r.windows),l=Tp.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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Nfe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=bOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=tC(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,ht=t.replace(fOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=uOe[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=ln.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(Yl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Nfe(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(Yl("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(Yl("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||ln.hasRegexChars(B))continue;let Oe=ln.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=pOe(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=dOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","}"));E.output=ln.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};tC.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=I8[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}=Tp.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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};C8.exports=tC});var M8=v((ppt,j8)=>{"use strict";var vOe=R8(),rC=D8(),N8=Ep(),SOe=kp(),wOe=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=wOe(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?N8.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(N8.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)):rC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>vOe(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=rC.fastpaths(t,e)),i.output||(i=rC(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=SOe;j8.exports=Rt});var U8=v((mpt,z8)=>{"use strict";var F8=M8(),xOe=Ep();function L8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:xOe.isWindows()}),F8(t,e,r)}Object.assign(L8,F8);z8.exports=L8});import{readdir as $Oe,readdirSync as kOe,realpath as EOe,realpathSync as AOe,stat as TOe,statSync as OOe}from"fs";import{isAbsolute as ROe,posix as Wa,resolve as IOe}from"path";import{fileURLToPath as POe}from"url";function jOe(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]===".."&&NOe.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 LOe(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 H8(t){return t.replace(DOe,e=>`${e}/`)}function V8(t){var e;let r=Xl.default.scan(t,zOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Xl.default.scan(t);return r.isGlob||r.negated}function Op(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function W8(t){return typeof t=="string"?[t]:t??[]}function nC(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=GOe(o);s=ROe(s.replace(WOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=VOe.exec(s))===null||i===void 0?void 0:i[0],l=V8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=H8(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 KOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(nC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(nC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(nC(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=KOe(t,e,n);t.debug&&Op("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(G8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Xl.default)(i.match,f),m=(0,Xl.default)(i.ignore,f),h=jOe(i.match,f),g=q8(r,d,o),b=o?g:q8(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 g8({filters:[a?(w,R)=>{let A=g(w,R),T=p(A)&&!m(A);return T&&Op(`matched ${A}`),T}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return Op(`${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&&Op("internal properties:",{...n,root:d}),[x,r!==d&&!o&&LOe(r,d)]}function YOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function XOe(t){let e=Object.assign({},t);for(let r in B8)e[r]===void 0&&Object.assign(e,{[r]:B8[r]});return e.cwd=(e.cwd instanceof URL?POe(e.cwd):IOe(e.cwd||process.cwd())).replace(G8,"/"),e.ignore=W8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||$Oe,readdirSync:e.fs.readdirSync||kOe,realpath:e.fs.realpath||EOe,realpathSync:e.fs.realpathSync||AOe,stat:e.fs.stat||TOe,statSync:e.fs.statSync||OOe}),e.debug&&Op("globbing with options:",e),e}function QOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=COe(t)||typeof t=="string",i=W8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=XOe(n?e:t);return i.length>0?JOe(o,i):[]}function vs(t,e){let[r,n]=QOe(t,e);return r?YOe(r.sync(),n):[]}var Xl,COe,G8,DOe,Z8,NOe,MOe,FOe,zOe,UOe,qOe,HOe,BOe,GOe,VOe,WOe,B8,Rp=y(()=>{y8();Xl=wt(U8(),1),COe=Array.isArray,G8=/\\/g,DOe=/^[A-Za-z]:$/,Z8=process.platform==="win32",NOe=/^(\/?\.\.)+$/;MOe=/^[A-Z]:\/$/i,FOe=Z8?t=>MOe.test(t):t=>t==="/";zOe={parts:!0};UOe=/(?t.replace(UOe,"\\$&"),BOe=t=>t.replace(qOe,"\\$&"),GOe=Z8?BOe:HOe;VOe=/^(\/?\.\.)+/,WOe=/\\(?=[()[\]{}!*+?@|])/g;B8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Ip,readFileSync as eRe,readdirSync as tRe,statSync as K8}from"node:fs";import{join as Ka}from"node:path";function rRe(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}=iC(r);return(s.size>0||a.length>0)&&!Ip(Ka(e,i.mainRoot))?[{detector:Pp,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&&(nRe(e,i,s,o),iRe(e,i,s,o)),a.length>0&&oRe(e,i,a,o),o)}function iC(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 nRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of tRe(o)){let a=Ka(o,s);K8(a).isDirectory()&&(r.has(s)||n.push({detector:Pp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function iRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of r){let a=Ka(o,s);Ip(a)&&K8(a).isDirectory()||n.push({detector:Pp,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 oRe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Ip(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=eRe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];sRe(p,s.to,e.importStyle)&&n.push({detector:Pp,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 sRe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Pp,J8,oC=y(()=>{"use strict";Rp();Ue();Va();Pp="ARCHITECTURE_FROM_SPEC";J8={name:Pp,run:rRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t,r=lRe(e,"spec/capabilities.yaml");if(!aRe(r))return[];let n;try{let u=cRe(r,"utf8"),d=Y8.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";Y8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",uRe=8;X8={name:Wv,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function hRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function gRe(t){let{cwd:e="."}=t;return ye(e,sC,r=>yRe(r,e))}function yRe(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=mRe(e,o);if(!fRe(s))continue;let a=pRe(s,"utf8");hRe(a)||n.push({detector:sC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var sC,e5,t5=y(()=>{"use strict";Va();xt();sC="CONVENTION_DRIFT";e5={name:sC,run:gRe}});import{existsSync as aC,readFileSync as r5}from"node:fs";import{join as Kv}from"node:path";function _Re(t){return JSON.parse(t).total?.lines?.pct??0}function n5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function SRe(t,e){if(!Cv(_t(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=jP.find(d=>aC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=n5(r5(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=i5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function wRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=SRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?jP.find(a=>aC(Kv(e,a)))??FJ(e):n.coverageSummary,o=Kv(e,i);if(!aC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=r5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?bRe(a):n.coverageFormat==="cobertura-xml"?vRe(a):_Re(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,o5,s5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;o5={name:Eo,run:wRe}});import{existsSync as xRe}from"node:fs";import{join as $Re}from"node:path";function ERe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>ARe(r,e))}function ARe(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",kRe=8;a5={name:Yv,run:ERe}});function TRe(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 ORe(t){let e=TRe(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 RRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>ORe(r))}var Xv,l5,u5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";l5={name:Xv,run:RRe}});function IRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>PRe(r,e))}function PRe(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,cC=y(()=>{"use strict";El();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:IRe}});function CRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return DRe(r)}function DRe(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:d5,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 d5,tS,lC=y(()=>{"use strict";Ue();d5="DEPENDENCY_CYCLE";tS={name:d5,run:CRe}});import{appendFileSync as NRe,existsSync as f5,mkdirSync as jRe,readFileSync as MRe}from"node:fs";import{dirname as FRe,join as LRe}from"node:path";function p5(t){return LRe(t,zRe,URe)}function m5(t){return uC.add(t),()=>uC.delete(t)}function Ja(t,e){let r=p5(t),n=FRe(r);f5(n)||jRe(n,{recursive:!0}),NRe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of uC)try{i(t,e)}catch{}}function pr(t){let e=p5(t);if(!f5(e))return[];let r=MRe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var zRe,URe,uC,un=y(()=>{"use strict";zRe=".cladding",URe="audit.log.jsonl";uC=new Set});import{existsSync as qRe}from"node:fs";import{join as HRe}from"node:path";function BRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:dC,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&&(qRe(HRe(e,i.artifact))||n.push({detector:dC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var dC,h5,g5=y(()=>{"use strict";un();dC="EVIDENCE_MISMATCH";h5={name:dC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function WRe(t){let e=VRe(t,v5);if(!GRe(e))return null;try{let n=((0,b5.parse)(ZRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*_5(t,e){for(let r of t??[])r.startsWith(y5)&&(yield{ref:r,name:r.slice(y5.length),field:e})}function KRe(t){let{cwd:e="."}=t,r=WRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:fC,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=[..._5(s.evidence_refs,"evidence_refs"),..._5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:fC,severity:"warn",path:v5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var b5,fC,y5,v5,S5,w5=y(()=>{"use strict";b5=wt(tr(),1);Ue();fC="FIXTURE_REFERENCE_INVALID",y5="fixture:",v5="conformance/fixtures.yaml";S5={name:fC,run:KRe}});import{existsSync as Ql,readFileSync as pC}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 Cp(t){if(!Ql(t))return null;try{return JSON.parse(pC(t,"utf8"))}catch{return null}}function YRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(pC(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 XRe(t,e){for(let r of x5){let n=Ya(t,r.path);if(!Ql(n))continue;let i=Cp(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 QRe(t,e){let r=Cp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of x5){let s=Ya(t,o.path);if(!Ql(s))continue;let a=Cp(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(Ql(i)){let o=Cp(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 eIe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function tIe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Ql(r)||!Ql(n))return;let i=eIe(pC(r,"utf8"));if(i.length===0)return;let s=Cp(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 rIe(t){let{cwd:e="."}=t,r=[];return YRe(e,r),tIe(e,r),XRe(e,r),QRe(e,r),r}var Ao,x5,$5,k5=y(()=>{"use strict";Rp();Ao="HARNESS_INTEGRITY",x5=[{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"]}];$5={name:Ao,run:rIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function aIe(t){let{cwd:e="."}=t;return ye(e,rS,r=>lIe(r,e))}function cIe(t){let e=oIe(t,"spec/capabilities.yaml");if(!nIe(e))return!1;try{let r=E5.default.parse(iIe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function lIe(t,e){let r=t.features.length;if(r{"use strict";E5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",sIe=8;A5={name:rS,run:aIe}});function uIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function dIe(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]=rIe(r.toml,r.ptr),o=nIe(r.toml,n,i);super(`Invalid TOML document: ${e} +`))}return i}var ge,Xa=y(()=>{ge=class extends Error{line;column;codeblock;constructor(e,r){let[n,i]=uIe(r.toml,r.ptr),o=dIe(r.toml,n,i);super(`Invalid TOML document: ${e} -${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function iIe(t,e){let r=0;for(;t[e-++r]==="\\";);return--r&&r%2}function nS(t,e=0,r=t.length){let n=t.indexOf(` -`,e);return t[n-1]==="\r"&&n--,n<=r?n:-1}function Ql(t,e){for(let r=e;r-1&&r!=="'"&&iIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Cp=y(()=>{Xa();});var oIe,Qa,mC=y(()=>{oIe=/^(\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(oIe);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]===` +`))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!=="'"&&fIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Dp=y(()=>{Xa();});var pIe,Qa,mC=y(()=>{pIe=/^(\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(pIe);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{Cp();mC();Xa();sIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,aIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,cIe=/^[+-]?0[0-9_]/,lIe=/^[0-9a-f]{2,8}$/i,O5={b:"\b",t:" ",n:` -`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function uIe(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==="["?P5(t,e,n,i):I5(t,e,n,i);if(r){if(l=dn(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=dn(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=T5(t,e,",",r);let a=uIe(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=dn(t,e+a[1]),s+=+(t[s]===",")),[R5(a[0],t,e,i),s]}var gC=y(()=>{hC();yC();Cp();Xa();});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(!dIe.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{hC();gC();Cp();Xa();dIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function C5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{yC();gC();Cp();Xa();});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 fIe(t){for(let e=0;e{Dp();mC();Xa();mIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,hIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,gIe=/^[+-]?0[0-9_]/,yIe=/^[0-9a-f]{2,8}$/i,R5={b:"\b",t:" ",n:` +`,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function _Ie(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(eu(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Np(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==="["?C5(t,e,n,i):P5(t,e,n,i);if(r){if(l=dn(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=dn(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=O5(t,e,",",r);let a=_Ie(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=dn(t,e+a[1]),s+=+(t[s]===",")),[I5(a[0],t,e,i),s]}var gC=y(()=>{hC();yC();Dp();Xa();});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(!bIe.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{hC();gC();Dp();Xa();bIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function D5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{yC();gC();Dp();Xa();});function jp(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function vIe(t){for(let e=0;e{N5=/^[a-z0-9-_]+$/i});var xC={};Nr(xC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>gIe,parse:()=>_C,stringify:()=>wC});var gIe,$C=y(()=>{D5();j5();mC();Xa();gIe={parse:_C,stringify:wC,TomlDate:Qa,TomlError:ge}});import{cpSync as yIe,existsSync as jn,lstatSync as _Ie,mkdirSync as bIe,readFileSync as uS,readlinkSync as vIe,readdirSync as SIe,rmSync as F5,writeFileSync as ec}from"node:fs";import{homedir as L5,platform as z5}from"node:os";import{basename as wIe,dirname as Ss,isAbsolute as xIe,join as he,relative as $Ie,resolve as ws}from"node:path";import{fileURLToPath as kIe}from"node:url";import{spawnSync as U5}from"node:child_process";function aS(t){bIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return _Ie(t).isSymbolicLink()}catch{return!1}}function TIe(t){try{return ws(Ss(t),vIe(t))}catch{return null}}function q5(t,e){let r=$Ie(ws(e),ws(t));return r===""||!r.startsWith("..")&&!xIe(r)}function OIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",EC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=TIe(t);if(!r||!e.some(n=>q5(r,n)))return"skipped-different";try{return F5(t,{force:!0}),"removed"}catch{return"failed"}}function RIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of SIe(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]===AC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>q5(n[0],i))}function IIe(t,e){let r=t.split(` +`:n}var j5,M5=y(()=>{j5=/^[a-z0-9-_]+$/i});var xC={};Nr(xC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>$Ie,parse:()=>_C,stringify:()=>wC});var $Ie,$C=y(()=>{N5();M5();mC();Xa();$Ie={parse:_C,stringify:wC,TomlDate:Qa,TomlError:ge}});import{cpSync as kIe,existsSync as jn,lstatSync as EIe,mkdirSync as AIe,readFileSync as uS,readlinkSync as TIe,readdirSync as OIe,rmSync as L5,writeFileSync as ec}from"node:fs";import{homedir as z5,platform as U5}from"node:os";import{basename as RIe,dirname as Ss,isAbsolute as IIe,join as he,relative as PIe,resolve as ws}from"node:path";import{fileURLToPath as CIe}from"node:url";import{spawnSync as q5}from"node:child_process";function aS(t){AIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return EIe(t).isSymbolicLink()}catch{return!1}}function jIe(t){try{return ws(Ss(t),TIe(t))}catch{return null}}function H5(t,e){let r=PIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!IIe(r)}function MIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",EC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=jIe(t);if(!r||!e.some(n=>H5(r,n)))return"skipped-different";try{return L5(t,{force:!0}),"removed"}catch{return"failed"}}function FIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of OIe(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 Lp(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]===AC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>H5(n[0],i))}function LIe(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 PIe(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(()=>($C(),xC)),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=IIe(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 CIe(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,ec(r,`${JSON.stringify(i,null,2)} -`,"utf8"),"removed"):"skipped-different":"unchanged"}catch{return"failed"}}function DIe(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,tc(he(n,"plugin.json"),s)])}function NIe(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 jIe(t){let e=z5()==="win32"?"where":"which";return U5(e,[t],{stdio:"ignore"}).status===0}function MIe(t){if(!t||!jIe("claude"))return"manual-required";let e=U5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:z5()==="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 FIe(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 LIe(){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 zIe(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(` +`)}async function zIe(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(()=>($C(),xC)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Lp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=LIe(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 UIe(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?Lp(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 qIe(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=Fp(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 tu([o,tc(he(n,"plugin.json"),s)])}function HIe(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&&!Lp(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function BIe(t){let e=U5()==="win32"?"where":"which";return q5(e,[t],{stdio:"ignore"}).status===0}function GIe(t){if(!t||!BIe("claude"))return"manual-required";let e=q5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:U5()==="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 ZIe(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 VIe(){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 WIe(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(` `)?` `:"";ec(e,`${n}${s}${o.join(` `)} -`,"utf8")}function UIe(){return{command:"node",args:[AC]}}function kC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- -`))return"failed";let i=wIe(e),o=/^name:\s*.*$/m.test(n)?n.replace(/^name:\s*.*$/m,`name: ${i}`):n.replace(/^---\n/,`--- +`,"utf8")}function KIe(){return{command:"node",args:[AC]}}function kC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- +`))return"failed";let i=RIe(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";F5(e,{recursive:!0,force:!0})}return aS(Ss(e)),yIe(t,e,{recursive:!0,dereference:!0}),ec(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,tc(t,`${JSON.stringify(i,null,2)} -`))}catch{return"failed"}}function qIe(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 AIe)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 HIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>($C(),xC)),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,tc(t,i(s)))}catch{return"failed"}}function BIe(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 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 H5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function M5(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 OC(t={}){let e=t.home??L5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??B5(),i=t.version??G5(n),o=ZIe(e),s=new Set(t.hosts??EIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",EC),l=H5(c),u=[],d=[];aS(r),zIe(r);let f=[tc(he(r,AC),FIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),LIe()));let p=eu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?kC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=UIe(),b=OIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?MIe(t.activate??!0):"unchanged",x={claude_plugin:eu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:NIe(e,b),codex_skills:RIe(e,b),codex_mcp:await PIe(e,b),cursor_mcp:CIe(e,b)},w=s.has("codex")?await HIe(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),DIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?eu([kC(m,he(r,".claude","skills","cladding-init"),a),Mp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?eu([kC(m,he(r,".cursor","skills","cladding-init"),a),Mp(he(r,".cursor","mcp.json"),g,a),qIe(he(r,".cursor","cli.json")),BIe(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))M5(J,X,u,d);for(let[X,J]of Object.entries(x))M5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${GIe(ae)} -`),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 GIe(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 B5(){let t=kIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function G5(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 fn(t=B5()){let e=G5(t);return e==="unknown"?null:e}function Z5(t=process.cwd()){return H5(he(ws(t),".cladding",EC))}function ZIe(t=L5()){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 EC,AC,TC,EIe,AIe,tu=y(()=>{"use strict";EC="setup-status.json",AC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",EIe=["claude","codex","gemini","antigravity","cursor"],AIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as V5,readFileSync as W5}from"node:fs";import{join as K5}from"node:path";function J5(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 XIe(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 Y5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function X5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function QIe(t,e){let r=X5(t),n=X5(e);if(!r||!n)return!1;for(let i=0;iYIe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(KIe)?.[1],s=fn();return o!==void 0&&s!==null&&QIe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function tPe(t){let e=K5(t,"README.md"),r=K5(t,"docs","dogfood","matrix.md");if(!V5(e)||!V5(r))return[];let n=W5(e,"utf8"),i=W5(r,"utf8"),o=J5(n,VIe),s=J5(i,WIe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=Y5(d);if(f===null)continue;let p=s[u]??"not-run",m=XIe(p);m!==null&&f>m&&a.push({detector:RC,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=>Y5(u)!==null)?ePe(i,Date.now()):[];return l.length>0&&a.push({detector:RC,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 rPe(t){let{cwd:e="."}=t;return tPe(e)}var RC,VIe,WIe,KIe,JIe,YIe,Q5,eY=y(()=>{"use strict";tu();RC="HOST_CLAIM_DRIFT",VIe=//,WIe=//,KIe=/^- Cladding version:\s*`([^`]+)`\s*$/m,JIe=/^- Generated:\s*(\S+)\s*$/m,YIe=720*60*60*1e3;Q5={name:RC,run:rPe}});function nPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return tY(r.features.map(i=>i.id),"feature","spec/features/",n),tY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function tY(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:rY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var rY,nY,iY=y(()=>{"use strict";Ue();rY="ID_COLLISION";nY={name:rY,run:nPe}});import{existsSync as Lp,readFileSync as IC,readdirSync as PC,statSync as iPe,writeFileSync as sY}from"node:fs";import{join as To}from"node:path";function oY(t){if(!Lp(t))return 0;try{return PC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function oPe(t){if(!Lp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=PC(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=iPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function sPe(t){let e=To(t,"spec","capabilities.yaml");if(!Lp(e))return 0;try{let r=dS.default.parse(IC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=oY(To(t,"spec","features")),r=oY(To(t,"spec","scenarios")),n=sPe(t),i=oPe(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=IC(r,"utf8"),i=aPe(n,e);i!==n&&sY(r,i)}function aPe(t,e){let r=t.includes(`\r +`);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";L5(e,{recursive:!0,force:!0})}return aS(Ss(e)),kIe(t,e,{recursive:!0,dereference:!0}),ec(he(e,"SKILL.md"),o,"utf8"),"created"}function Fp(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&&!Lp(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 NIe)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 YIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>($C(),xC)),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&&!Lp(c,[])?"skipped-different":(a.cladding=l,tc(t,i(s)))}catch{return"failed"}}function XIe(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 tu(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 B5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function F5(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 OC(t={}){let e=t.home??z5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??G5(),i=t.version??Z5(n),o=ePe(e),s=new Set(t.hosts??DIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",EC),l=B5(c),u=[],d=[];aS(r),WIe(r);let f=[tc(he(r,AC),ZIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),VIe()));let p=tu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?kC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=KIe(),b=MIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?GIe(t.activate??!0):"unchanged",x={claude_plugin:tu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:HIe(e,b),codex_skills:FIe(e,b),codex_mcp:await zIe(e,b),cursor_mcp:UIe(e,b)},w=s.has("codex")?await YIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?Fp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?tu([Fp(he(r,".agents","mcp_config.json"),g,a),qIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?tu([kC(m,he(r,".claude","skills","cladding-init"),a),Fp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?tu([kC(m,he(r,".cursor","skills","cladding-init"),a),Fp(he(r,".cursor","mcp.json"),g,a),JIe(he(r,".cursor","cli.json")),XIe(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))F5(J,X,u,d);for(let[X,J]of Object.entries(x))F5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${QIe(ae)} +`),ae}function Mp(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 QIe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${Mp(t.wiring.claude)}`,` Codex \u2192 ${Mp(t.wiring.codex)}`,` Gemini CLI \u2192 ${Mp(t.wiring.gemini)}`,` Antigravity \u2192 ${Mp(t.wiring.antigravity)}`,` Cursor \u2192 ${Mp(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 G5(){let t=CIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function Z5(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 fn(t=G5()){let e=Z5(t);return e==="unknown"?null:e}function V5(t=process.cwd()){return B5(he(ws(t),".cladding",EC))}function ePe(t=z5()){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 EC,AC,TC,DIe,NIe,ru=y(()=>{"use strict";EC="setup-status.json",AC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",DIe=["claude","codex","gemini","antigravity","cursor"],NIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as W5,readFileSync as K5}from"node:fs";import{join as J5}from"node:path";function Y5(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 sPe(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 X5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function Q5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function aPe(t,e){let r=Q5(t),n=Q5(e);if(!r||!n)return!1;for(let i=0;ioPe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(nPe)?.[1],s=fn();return o!==void 0&&s!==null&&aPe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function lPe(t){let e=J5(t,"README.md"),r=J5(t,"docs","dogfood","matrix.md");if(!W5(e)||!W5(r))return[];let n=K5(e,"utf8"),i=K5(r,"utf8"),o=Y5(n,tPe),s=Y5(i,rPe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=X5(d);if(f===null)continue;let p=s[u]??"not-run",m=sPe(p);m!==null&&f>m&&a.push({detector:RC,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=>X5(u)!==null)?cPe(i,Date.now()):[];return l.length>0&&a.push({detector:RC,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 uPe(t){let{cwd:e="."}=t;return lPe(e)}var RC,tPe,rPe,nPe,iPe,oPe,eY,tY=y(()=>{"use strict";ru();RC="HOST_CLAIM_DRIFT",tPe=//,rPe=//,nPe=/^- Cladding version:\s*`([^`]+)`\s*$/m,iPe=/^- Generated:\s*(\S+)\s*$/m,oPe=720*60*60*1e3;eY={name:RC,run:uPe}});function dPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return rY(r.features.map(i=>i.id),"feature","spec/features/",n),rY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function rY(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:nY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var nY,iY,oY=y(()=>{"use strict";Ue();nY="ID_COLLISION";iY={name:nY,run:dPe}});import{existsSync as zp,readFileSync as IC,readdirSync as PC,statSync as fPe,writeFileSync as aY}from"node:fs";import{join as To}from"node:path";function sY(t){if(!zp(t))return 0;try{return PC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function pPe(t){if(!zp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=PC(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=fPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function mPe(t){let e=To(t,"spec","capabilities.yaml");if(!zp(e))return 0;try{let r=dS.default.parse(IC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=sY(To(t,"spec","features")),r=sY(To(t,"spec","scenarios")),n=mPe(t),i=pPe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function nu(t,e){let r=To(t,"spec.yaml");if(!zp(r))return;let n=IC(r,"utf8"),i=hPe(n,e);i!==n&&aY(r,i)}function hPe(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(!Lp(e))return!1;let r=[];for(let i of PC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(IC(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 rc(t="."){let e=To(t,"spec","features");if(!zp(e))return!1;let r=[];for(let i of PC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(IC(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 sY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,zp=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as aY,readFileSync as cY,readdirSync as cPe}from"node:fs";import{join as CC}from"node:path";function lPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=lY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return DC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...DC(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 lY){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(...DC(e)),o}function DC(t){let e=CC(t,"spec","index.yaml"),r=CC(t,"spec","features");if(!aY(e)||!aY(r))return[];let n=new Map;try{for(let l of cY(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 cPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=cY(CC(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,lY,uY,dY=y(()=>{"use strict";zp();Ue();Up="INVENTORY_DRIFT",lY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];uY={name:Up,run:lPe}});import{existsSync as uPe,readFileSync as dPe}from"node:fs";import{join as fPe}from"node:path";function mPe(t){let{cwd:e="."}=t,r=fPe(e,"src","spec","schema.json"),n=[];if(uPe(r)){let i;try{i=JSON.parse(dPe(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 pPe)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!==fY&&n.push({detector:qp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${fY}'`})}catch{}return n}var qp,pPe,fY,pY,mY=y(()=>{"use strict";Ue();qp="META_INTEGRITY",pPe=["schema","project","features"],fY="0.1";pY={name:qp,run:mPe}});function hPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return hY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),hY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function hY(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:gY,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 gY,yY,_Y=y(()=>{"use strict";Ue();gY="SLUG_CONFLICT";yY={name:gY,run:hPe}});function nu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as gPe}from"node:fs";import{join as yPe}from"node:path";function _Pe(t){let{cwd:e="."}=t;return ye(e,pS,r=>bPe(r,e))}function bPe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=yPe(e,i);gPe(o)||r.push(vPe(n.id,i,n.status))}return r}function vPe(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,NC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:_Pe}});function SPe(t){let{cwd:e="."}=t;return ye(e,jC,wPe)}function wPe(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:jC,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 jC,hS,MC=y(()=>{"use strict";xt();jC="MISSING_TESTS";hS={name:jC,run:SPe}});import{existsSync as xPe,readFileSync as $Pe}from"node:fs";import{join as bY}from"node:path";function vY(t){if(xPe(t))try{return JSON.parse($Pe(t,"utf8"))}catch{return}}function TPe(t){let{cwd:e="."}=t,r=vY(bY(e,kPe)),n=vY(bY(e,EPe));if(!r||!n)return[{detector:FC,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>APe&&i.push({detector:FC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var FC,kPe,EPe,APe,SY,wY=y(()=>{"use strict";FC="PERFORMANCE_DRIFT",kPe="perf/baseline.json",EPe="perf/current.json",APe=10;SY={name:FC,run:TPe}});import{existsSync as OPe}from"node:fs";import{join as RPe}from"node:path";function PPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>DPe(r,e))}function CPe(t,e){return(t.modules??[]).some(r=>OPe(RPe(e,r)))}function DPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||CPe(s,e)||r.push(s.id);let n=IPe;if(r.length<=n)return[];let i=r.slice(0,xY).join(", "),o=r.length>xY?", \u2026":"";return[{detector:LC,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 LC,IPe,xY,$Y,kY=y(()=>{"use strict";xt();LC="PLANNED_BACKLOG",IPe=5,xY=8;$Y={name:LC,run:PPe}});import{existsSync as NPe,readFileSync as jPe}from"node:fs";import{join as MPe}from"node:path";function zPe(t){let{cwd:e="."}=t;return ye(e,zC,r=>UPe(r,e))}function UPe(t,e){if(t.features.lengthn.includes(i))?[{detector:zC,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 zC,FPe,LPe,EY,AY=y(()=>{"use strict";xt();zC="PROJECT_CONTEXT_DRIFT",FPe=8,LPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];EY={name:zC,run:zPe}});function TY(t,e,r){return e?e.filter(n=>!t.has(n)).map(n=>({detector:gS,severity:"error",message:`${r} references unknown id '${n}'`})):[]}function qPe(t){let{cwd:e="."}=t;return ye(e,gS,HPe)}function HPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...TY(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(...TY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,UC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:qPe}});function Hp(t=""){return new RegExp(BPe,t)}var BPe,qC=y(()=>{"use strict";BPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as GPe,readdirSync as ZPe,readFileSync as VPe,statSync as WPe,writeFileSync as KPe}from"node:fs";import{dirname as JPe,join as Bp,normalize as YPe,relative as XPe}from"node:path";function nCe(t){let e=[];for(let r of t.matchAll(rCe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Hp("g"))??[])e.push(n);return[...new Set(e)].sort()}function iCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function OY(t){return t.split("\\").join("/")}function oCe(t){return QPe.some(e=>t===e||t.startsWith(`${e}/`))}function sCe(t){let e=Bp(t,"docs");if(!GPe(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=WPe(a)}catch{continue}let l=OY(XPe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function aCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=YPe(Bp(JPe(t),e));return OY(r)}function Gp(t="."){let e=[];for(let r of sCe(t)){let n;try{n=VPe(Bp(t,r),"utf8")}catch{continue}let i=iCe(n),o=nCe(i);if(oCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(eCe)?[]:i.match(Hp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(tCe)){let d=aCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function RY(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 KPe(Bp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return aY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,Up=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as cY,readFileSync as lY,readdirSync as gPe}from"node:fs";import{join as CC}from"node:path";function yPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=uY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return DC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...DC(e),{detector:qp,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 uY){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:qp,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(...DC(e)),o}function DC(t){let e=CC(t,"spec","index.yaml"),r=CC(t,"spec","features");if(!cY(e)||!cY(r))return[];let n=new Map;try{for(let l of lY(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 gPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=lY(CC(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:qp,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:qp,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 qp,uY,dY,fY=y(()=>{"use strict";Up();Ue();qp="INVENTORY_DRIFT",uY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];dY={name:qp,run:yPe}});import{existsSync as _Pe,readFileSync as bPe}from"node:fs";import{join as vPe}from"node:path";function wPe(t){let{cwd:e="."}=t,r=vPe(e,"src","spec","schema.json"),n=[];if(_Pe(r)){let i;try{i=JSON.parse(bPe(r,"utf8"))}catch(o){n.push({detector:Hp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of SPe)i.required?.includes(o)||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==pY&&n.push({detector:Hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${pY}'`})}catch{}return n}var Hp,SPe,pY,mY,hY=y(()=>{"use strict";Ue();Hp="META_INTEGRITY",SPe=["schema","project","features"],pY="0.1";mY={name:Hp,run:wPe}});function xPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return gY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),gY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function gY(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:yY,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 yY,_Y,bY=y(()=>{"use strict";Ue();yY="SLUG_CONFLICT";_Y={name:yY,run:xPe}});function iu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as $Pe}from"node:fs";import{join as kPe}from"node:path";function EPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>APe(r,e))}function APe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=kPe(e,i);$Pe(o)||r.push(TPe(n.id,i,n.status))}return r}function TPe(t,e,r){return iu(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,NC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:EPe}});function OPe(t){let{cwd:e="."}=t;return ye(e,jC,RPe)}function RPe(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:jC,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 jC,hS,MC=y(()=>{"use strict";xt();jC="MISSING_TESTS";hS={name:jC,run:OPe}});import{existsSync as IPe,readFileSync as PPe}from"node:fs";import{join as vY}from"node:path";function SY(t){if(IPe(t))try{return JSON.parse(PPe(t,"utf8"))}catch{return}}function jPe(t){let{cwd:e="."}=t,r=SY(vY(e,CPe)),n=SY(vY(e,DPe));if(!r||!n)return[{detector:FC,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>NPe&&i.push({detector:FC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var FC,CPe,DPe,NPe,wY,xY=y(()=>{"use strict";FC="PERFORMANCE_DRIFT",CPe="perf/baseline.json",DPe="perf/current.json",NPe=10;wY={name:FC,run:jPe}});import{existsSync as MPe}from"node:fs";import{join as FPe}from"node:path";function zPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>qPe(r,e))}function UPe(t,e){return(t.modules??[]).some(r=>MPe(FPe(e,r)))}function qPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||UPe(s,e)||r.push(s.id);let n=LPe;if(r.length<=n)return[];let i=r.slice(0,$Y).join(", "),o=r.length>$Y?", \u2026":"";return[{detector:LC,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 LC,LPe,$Y,kY,EY=y(()=>{"use strict";xt();LC="PLANNED_BACKLOG",LPe=5,$Y=8;kY={name:LC,run:zPe}});import{existsSync as HPe,readFileSync as BPe}from"node:fs";import{join as GPe}from"node:path";function WPe(t){let{cwd:e="."}=t;return ye(e,zC,r=>KPe(r,e))}function KPe(t,e){if(t.features.lengthn.includes(i))?[{detector:zC,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 zC,ZPe,VPe,AY,TY=y(()=>{"use strict";xt();zC="PROJECT_CONTEXT_DRIFT",ZPe=8,VPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];AY={name:zC,run:WPe}});function OY(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,YPe)}function YPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...OY(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(...OY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,UC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:JPe}});function Bp(t=""){return new RegExp(XPe,t)}var XPe,qC=y(()=>{"use strict";XPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as QPe,readdirSync as eCe,readFileSync as tCe,statSync as rCe,writeFileSync as nCe}from"node:fs";import{dirname as iCe,join as Gp,normalize as oCe,relative as sCe}from"node:path";function dCe(t){let e=[];for(let r of t.matchAll(uCe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Bp("g"))??[])e.push(n);return[...new Set(e)].sort()}function fCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function RY(t){return t.split("\\").join("/")}function pCe(t){return aCe.some(e=>t===e||t.startsWith(`${e}/`))}function mCe(t){let e=Gp(t,"docs");if(!QPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=eCe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Gp(i,s),c;try{c=rCe(a)}catch{continue}let l=RY(sCe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function hCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=oCe(Gp(iCe(t),e));return RY(r)}function Zp(t="."){let e=[];for(let r of mCe(t)){let n;try{n=tCe(Gp(t,r),"utf8")}catch{continue}let i=fCe(n),o=dCe(i);if(pCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(cCe)?[]:i.match(Bp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(lCe)){let d=hCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function IY(t="."){let e=Zp(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 nCe(Gp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var QPe,eCe,tCe,rCe,_S=y(()=>{"use strict";qC();QPe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],eCe="clad-doc-links: ignore",tCe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,rCe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as cCe}from"node:fs";import{join as lCe}from"node:path";function uCe(t){let{cwd:e="."}=t;return ye(e,bS,r=>dCe(r,e))}function dCe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Gp(e).docs){for(let o of i.doc_links)cCe(lCe(e,o))||n.push({detector:bS,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:bS,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 bS,vS,HC=y(()=>{"use strict";_S();xt();bS="DOC_LINK_INTEGRITY";vS={name:bS,run:uCe}});function fCe(t){let{cwd:e="."}=t;return ye(e,Zp,r=>pCe(r))}function pCe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=IY,o=t.project.onboarding_seeded===!0&&!i;r>=IY&&n.length===0&&e.push({detector:Zp,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:Zp,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:Zp,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 Zp,IY,PY,CY=y(()=>{"use strict";xt();Zp="SCENARIO_COVERAGE",IY=8;PY={name:Zp,run:fCe}});import{createHash as mCe}from"node:crypto";function hCe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Vp(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??DY),sample:hCe(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(DY),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Wp(t){return(t.features??[]).filter(e=>e.status==="done").length}function gCe(t,e){return e<=0?!1:e>=1?!0:parseInt(mCe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var DY,SS=y(()=>{"use strict";DY=["unwanted"]});import{chmodSync as yCe,existsSync as jY,readFileSync as _Ce,readdirSync as bCe,statSync as MY,unlinkSync as vCe,utimesSync as SCe,writeFileSync as wCe}from"node:fs";import{join as FY}from"node:path";import LY from"node:process";function xCe(t){return TJ(t).map(e=>{try{let r=MY(e);return r.isFile()?{path:e,body:_Ce(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(!jY(r.path))continue;if(!MY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}vCe(r.path);continue}wCe(r.path,r.body),r.mode!==void 0&&yCe(r.path,r.mode),r.atime&&r.mtime&&SCe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function kCe(t){let e=!1,r=n=>{for(let i of bCe(n,{withFileTypes:!0})){if(e)return;let o=FY(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 BC(t={}){let{cwd:e="."}=t,r=FY(e,$s);if(!jY(r)||!kCe(r))return{stage:nc,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${$s}/ \u2014 skipped`};let n=_t(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=xCe(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,ECe,GC=y(()=>{"use strict";zr();Dn();vp();Nn();nc="stage_2.3",$s="tests/oracle";ECe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${LY.argv[1]}`;if(ECe){let t=BC();console.log(JSON.stringify(t)),LY.exit(t.exitCode)}});import{existsSync as ACe}from"node:fs";import{join as TCe}from"node:path";function OCe(t){let{cwd:e="."}=t;return ye(e,ai,r=>RCe(r,e))}function RCe(t,e){let r=[],n=Vp(t.project,Wp(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(Kp(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(!ACe(TCe(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,zY,UY=y(()=>{"use strict";un();SS();GC();xt();ai="SPEC_CONFORMANCE";zY={name:ai,run:OCe}});function ICe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:ZC,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>qY&&i.push({detector:ZC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${qY})`})}return i}var ZC,qY,HY,BY=y(()=>{"use strict";un();ZC="STALE_EVIDENCE",qY=90;HY={name:ZC,run:ICe}});import{existsSync as GY}from"node:fs";import{join as ZY}from"node:path";function PCe(t){let{cwd:e="."}=t;return ye(e,iu,r=>CCe(r,e))}function CCe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:iu,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:iu,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=>GY(ZY(e,o)));i.length>0&&r.push({detector:iu,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}nu(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>GY(ZY(e,i)))&&r.push({detector:iu,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 iu,wS,VC=y(()=>{"use strict";fS();xt();iu="STALE_SPECIFICATION";wS={name:iu,run:PCe}});import{existsSync as VY,statSync as WY}from"node:fs";import{join as KY}from"node:path";function NCe(t,e){let r=0;for(let n of e){let i=KY(t,n);if(!VY(i))continue;let o=WY(i).mtimeMs;o>r&&(r=o)}return r}function jCe(t){let{cwd:e="."}=t;return ye(e,WC,r=>MCe(r,e))}function MCe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=NCe(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=KY(e,a);if(!VY(c))continue;let l=WY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>DCe&&s.push({detector:WC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var WC,DCe,xS,KC=y(()=>{"use strict";Op();Va();xt();WC="STALE_TESTS",DCe=30;xS={name:WC,run:jCe}});import{existsSync as FCe}from"node:fs";import{join as LCe}from"node:path";function zCe(t){let{cwd:e="."}=t;return ye(e,Jp,r=>UCe(r,e))}function UCe(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:Jp,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=>!FCe(LCe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Jp,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:Jp,severity:nu(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 Jp,$S,JC=y(()=>{"use strict";fS();xt();Jp="STATUS_DRIFT";$S={name:Jp,run:zCe}});import{readdirSync as qCe}from"node:fs";import{extname as HCe,join as BCe}from"node:path";function YY(t){return t.maxFiles!==void 0&&t.maxFiles>=1?t.maxFiles:ZCe}function XY(t,e,r){let n=0,i=[t];for(;i.length>0&&n=e)break;n+=1,r(HCe(a.name).toLowerCase())}}}}function QY(t,e={}){let r={},n=0;XY(t,YY(e),s=>{let a=ic[s];a!==void 0&&(r[a]=(r[a]??0)+1,n+=1)});let i=Object.keys(r).sort(),o=null;for(let s of i)(o===null||r[s]>r[o])&&(o=s);return{counts:r,classified:n,set:i,dominant:o,share(s){return n===0?0:(r[s]??0)/n}}}function eX(t,e={}){let r=new Set;return XY(t,YY(e),n=>{ic[n]!==void 0&&r.add(n)}),[...r].sort()}var ic,JY,GCe,ZCe,kS=y(()=>{"use strict";ic={".ts":"typescript",".tsx":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".kt":"kotlin",".kts":"kotlin",".cs":"csharp",".rb":"ruby",".php":"php",".swift":"swift",".ex":"elixir",".exs":"elixir",".scala":"scala",".dart":"dart",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".h":"cpp"},JY=new Set(Object.values(ic)),GCe=new Set(["node_modules",".git","dist","build","out","coverage","target","vendor",".cladding"]),ZCe=2e4});function KCe(t){let{cwd:e="."}=t;return ye(e,ES,r=>YCe(r,e))}function JCe(t){return`{${Object.keys(t).sort((r,n)=>t[n]-t[r]||r.localeCompare(n)).map(r=>`${r} \xD7${t[r]}`).join(", ")}}`}function YCe(t,e){let r=t.project?.language??"";if(!JY.has(r))return[];let n=QY(e);return n.classified{"use strict";kS();xt();ES="TECH_STACK_MISMATCH",VCe=5,WCe=.1;tX={name:ES,run:KCe}});import{extname as XCe}from"node:path";function rDe(t,e){let r=new Map,n=new Map,i=0;for(let a of t.features??[])for(let c of a.modules??[]){let l=c.split("/"),u=l.findIndex((m,h)=>h0?n.roots:[eDe],o=new Set([...eX(e),...n.extensions]),s=new Set;for(let a of i){let c=a===""?"":`${a}/`;for(let l of r)for(let u of o)s.add(`${c}${l}/**/*${u}`)}return[...s].sort()}function iDe(t){let{cwd:e="."}=t;return ye(e,YC,r=>oDe(r,e))}function oDe(t,e){let r=new Set;for(let s of t.features)for(let a of s.modules??[])r.add(a);let n=nDe(t,e),i=n.length===0?[]:vs([...n],{cwd:e,dot:!1}),o=[];for(let s of i)r.has(s)||o.push({detector:YC,severity:"error",path:s,message:`file '${s}' is not claimed by any feature in spec.yaml`});return o}var YC,nX,QCe,eDe,tDe,AS,XC=y(()=>{"use strict";Op();kS();oC();xt();YC="UNMAPPED_ARTIFACT",nX=["src/stages/**/*.ts","src/spec/**/*.ts"],QCe=8,eDe="src",tDe=.25;AS={name:YC,run:iDe}});import{existsSync as iX}from"node:fs";import{join as oX}from"node:path";function aDe(t){return sDe.some(e=>t.startsWith(e))}function cDe(t){let{cwd:e="."}=t;return ye(e,QC,r=>lDe(r,e))}function lDe(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(aDe(o))continue;let s=o.split("#",1)[0];iX(oX(e,o))||s&&iX(oX(e,s))||r.push({detector:QC,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: +`}function ire(t){let e=new Map(t.nodes.map(s=>[s.id,s])),r=new Map,n=new Map;for(let s of t.edges)(r.get(s.from)??r.set(s.from,[]).get(s.from)).push({other:s.to,kind:s.kind}),(n.get(s.to)??n.set(s.to,[]).get(s.to)).push({other:s.from,kind:s.kind});let i=s=>{let a=e.get(s);return a?`[[${ere(a)}|${a.label.replace(/[[\]|]/g," ")}]]`:`[[${s.replace(/[[\]|]/g," ")}]]`},o=new Map;for(let s of t.nodes){let a=["---",`kind: ${s.kind}`,...s.tier?[`tier: ${s.tier}`]:[],...s.status?[`status: ${s.status}`]:[],`id: ${JSON.stringify(s.id)}`,"---",`# ${s.label}`,""],c=(r.get(s.id)??[]).slice().sort(tre);if(c.length>0){a.push("## Links");for(let u of c)a.push(`- ${u.kind} \u2192 ${i(u.other)}`);a.push("")}let l=(n.get(s.id)??[]).slice().sort(tre);if(l.length>0){a.push("## Backlinks");for(let u of l)a.push(`- ${i(u.other)} \u2192 ${u.kind}`);a.push("")}o.set(`${s.kind}/${ere(s)}.md`,`${a.join(` +`)}`)}return o}function tre(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as H4e}from"node:fs";import{dirname as B4e,join as Vj}from"node:path";import{fileURLToPath as G4e}from"node:url";var Wj=B4e(G4e(import.meta.url));function ore(t){for(let e of[Vj(Wj,"viewer",t),Vj(Wj,"..","graph","viewer",t),Vj(Wj,"..","..","dist","viewer",t)])try{return H4e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function sre(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -922,21 +927,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}lC();HC();NC();MC();UC();cC();KC();JC();XC();eD();oh();qC();Ue();var D4e=[hS,TS,mS,AS,yS,vS,tS,$S,xS,eS];function N4e(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 Jx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of D4e){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 N4e(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}Wj();Ue();Pi();var M4e=new Set(["mermaid","dot","json","obsidian","html"]);function ere(t={}){try{let e=t.format??"mermaid";if(!M4e.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=Bx(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=Hx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=Jte(i);for(let[c,l]of a){let u=j4e(s,c);Kj(Yj(u),{recursive:!0}),Jj(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=Kx(i,Jx(i,"."));Kj(Yj(t.out),{recursive:!0}),Jj(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"?Kte(i):r==="json"?Wx(i):Wte(i);t.out?(Kj(Yj(t.out),{recursive:!0}),Jj(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 tre(){try{let t=Ec(q(),".");process.stdout.write(Qte(Yx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as F4e}from"node:http";import{existsSync as L4e,watch as z4e}from"node:fs";import{join as U4e}from"node:path";Ue();Pi();function q4e(t={}){let e=t.cwd??".",r=new Set,n=()=>Ec(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}lC();HC();NC();MC();UC();cC();KC();JC();XC();eD();oh();qC();Ue();var Z4e=[hS,TS,mS,AS,yS,vS,tS,$S,xS,eS];function V4e(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=Bp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Jx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of Z4e){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 V4e(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}Kj();Ue();Pi();var K4e=new Set(["mermaid","dot","json","obsidian","html"]);function cre(t={}){try{let e=t.format??"mermaid";if(!K4e.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=Ac(n,".");if(t.focus){let s=Bx(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=Hx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ire(i);for(let[c,l]of a){let u=W4e(s,c);Jj(Xj(u),{recursive:!0}),Yj(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=Kx(i,Jx(i,"."));Jj(Xj(t.out),{recursive:!0}),Yj(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"?nre(i):r==="json"?Wx(i):rre(i);t.out?(Jj(Xj(t.out),{recursive:!0}),Yj(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 lre(){try{let t=Ac(q(),".");process.stdout.write(are(Yx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as J4e}from"node:http";import{existsSync as Y4e,watch as X4e}from"node:fs";import{join as Q4e}from"node:path";Ue();Pi();function eHe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ac(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=F4e((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=Wx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Jx(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 +`)}catch{r.delete(u)}},o=J4e((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=Wx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Jx(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=Kx(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=U4e(e,u);if(L4e(d))try{let f=z4e(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 +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Kx(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=Q4e(e,u);if(Y4e(d))try{let f=X4e(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 rre(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await q4e({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 H4e=["stage_1.1","stage_2.1","stage_2.3"];function B4e(t){return(t.features??[]).filter(e=>e.status==="done")}function G4e(t,e){let r=B4e(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 nre(t,e){let r=[];for(let n of H4e){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=G4e(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}DS();import ire from"node:process";function Z4e(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 Xx(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=Z4e(n,t);i.pass||r.push(i)}return r}un();var Xj="stage_4.1";function Qj(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Xj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Xx(r);if(n.length===0)return{stage:Xj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Xj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var V4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${ire.argv[1]}`;if(V4e){let t=Qj();console.log(JSON.stringify(t)),ire.exit(t.exitCode)}El();import{randomBytes as W4e}from"node:crypto";import{unlinkSync as K4e}from"node:fs";import{tmpdir as J4e}from"node:os";import{join as Y4e,resolve as eM}from"node:path";import X4e from"node:process";var Gr=null;function ore(t){Gr={cwd:eM(t),run:null,jsonFile:null}}function tM(){return Gr!==null}function rM(t,e){if(!Gr||Gr.cwd!==eM(t))return null;if(Gr.run)return Gr.run;let r=Y4e(J4e(),`clad-shared-vitest-${X4e.pid}-${W4e(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function sre(t){return!Gr||Gr.cwd!==eM(t)?null:Gr.run}function nM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function are(){let t=Gr?.jsonFile;if(Gr=null,t)try{K4e(t)}catch{}}zr();import cre from"node:process";var Qx="stage_1.4";function iM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Qx,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:Qx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Qx,pass:!0,exitCode:0}:{stage:Qx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var Q4e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${cre.argv[1]}`;if(Q4e){let t=iM();console.log(JSON.stringify(t)),cre.exit(t.exitCode)}zr();import lre from"node:process";sh();Nn();var e0="stage_2.2";function oM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:e0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:e0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=sre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(e0,r,s,n);return a||Xt(e0,s)}var rHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${lre.argv[1]}`;if(rHe){let t=oM();console.log(JSON.stringify(t)),lre.exit(t.exitCode)}Xp();aD();sM();zr();Dn();Nn();import dre from"node:process";var n0="stage_3.2";function aM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,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:n0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var wHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${dre.argv[1]}`;if(wHe){let t=aM();console.log(JSON.stringify(t)),dre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as xHe}from"node:fs";import{resolve as pre}from"node:path";import mre from"node:process";var fi="stage_2.4",cM=5e3,$He=3e4;function lM(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 EHe(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=pre(e,r.path);if(!xHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??cM,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 fre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},kHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function EHe(t,e,r){let n=Math.min(e.length*cM,$He),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(AHe(t,s,r))}return THe(o)}function AHe(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("/")?pre(t,a):a,u=cM,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 THe(t){let e="skip";for(let o of t)fre[o.disposition]>fre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${kHe[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 OHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mre.argv[1]}`;if(OHe){let t=lM();console.log(JSON.stringify(t)),mre.exit(t.exitCode)}zr();Dn();Nn();import hre from"node:process";var i0="stage_3.1";function uM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,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:i0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var RHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hre.argv[1]}`;if(RHe){let t=uM();console.log(JSON.stringify(t)),hre.exit(t.exitCode)}GC();dM();fM();zr();t0();import{randomBytes as MHe}from"node:crypto";import{unlinkSync as FHe}from"node:fs";import{tmpdir as LHe}from"node:os";import{join as zHe}from"node:path";import mM from"node:process";sh();Nn();Ue();import{readFileSync as CHe}from"node:fs";import{resolve as _re}from"node:path";function DHe(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=_re(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 NHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function jHe(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=NHe(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(_re(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 pM(t,e){try{let r=DHe(CHe(t,"utf8"));return r?jHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function bre(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function vre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Sre(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 UHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!bre(n,i))return null;let o=n,s=i,a=rM(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(nM(u)==="fallback")return null;if(r){let d=pM(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 qHe(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!vre(n,i))return null;let o=n,s=i,a=rM(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(nM(c)==="fallback")return null;if(r&&Sre(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 hM(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=bre(n,i),a=vre(n,i),c=r&&s;if(tM()&&s){let d=UHe(t,e,c);if(d)return d}if(tM()&&a){let d=qHe(t,e);if(d)return d}let l,u=i;c&&(l=zHe(LHe(),`clad-vitest-${mM.pid}-${MHe(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=Fu("unit",Xt(Zr,d),d);if(r&&p.pass&&Sre(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=pM(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{FHe(l)}catch{}}}var HHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${mM.argv[1]}`;if(HHe){let t=hM();console.log(JSON.stringify(t)),mM.exit(t.exitCode)}zr();Dn();Nn();import wre from"node:process";var a0="stage_3.3";function gM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:a0,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:a0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(a0,i,s,o);return a||Xt(a0,s)}var BHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(BHe){let t=gM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}VC();Gf();wa();_M();zp();_S();var Ore=wt(tr(),1);import{existsSync as bM,readFileSync as t6e,readdirSync as Tre,statSync as r6e,writeFileSync as n6e}from"node:fs";import{basename as dh,join as fh,relative as Are}from"node:path";var i6e=["self-dogfood:","fixture:","derived:"],Rre=/\.(test|spec)\.[jt]sx?$/;function Ire(t,e=t,r=[]){let n;try{n=Tre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{r6e(o).isDirectory()?Ire(t,o,r):Rre.test(i)&&r.push(o)}catch{continue}}return r}function Pre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!bM(e)||!bM(r))return{repaired:n,suggested:i};let o=Ire(r),s=new Map;for(let a of o){let c=Are(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of Tre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=t6e(c,"utf8"),u=(0,Ore.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(i6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(bM(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=>Are(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Rre,"");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 ure(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eHe({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 tHe=["stage_1.1","stage_2.1","stage_2.3"];function rHe(t){return(t.features??[]).filter(e=>e.status==="done")}function nHe(t,e){let r=rHe(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 dre(t,e){let r=[];for(let n of tHe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nHe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}DS();import fre from"node:process";function iHe(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 Xx(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=iHe(n,t);i.pass||r.push(i)}return r}un();var Qj="stage_4.1";function eM(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Qj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Xx(r);if(n.length===0)return{stage:Qj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Qj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(oHe){let t=eM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}Al();import{randomBytes as sHe}from"node:crypto";import{unlinkSync as aHe}from"node:fs";import{tmpdir as cHe}from"node:os";import{join as lHe,resolve as tM}from"node:path";import uHe from"node:process";var Gr=null;function pre(t){Gr={cwd:tM(t),run:null,jsonFile:null}}function rM(){return Gr!==null}function nM(t,e){if(!Gr||Gr.cwd!==tM(t))return null;if(Gr.run)return Gr.run;let r=lHe(cHe(),`clad-shared-vitest-${uHe.pid}-${sHe(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function mre(t){return!Gr||Gr.cwd!==tM(t)?null:Gr.run}function iM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function hre(){let t=Gr?.jsonFile;if(Gr=null,t)try{aHe(t)}catch{}}zr();import gre from"node:process";var Qx="stage_1.4";function oM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Qx,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:Qx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Qx,pass:!0,exitCode:0}:{stage:Qx,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var dHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(dHe){let t=oM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}zr();import yre from"node:process";sh();Nn();var e0="stage_2.2";function sM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:e0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:e0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(e0,r,s,n);return a||Xt(e0,s)}var mHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yre.argv[1]}`;if(mHe){let t=sM();console.log(JSON.stringify(t)),yre.exit(t.exitCode)}Qp();aD();aM();zr();Dn();Nn();import bre from"node:process";var n0="stage_3.2";function cM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:n0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var DHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(DHe){let t=cM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as NHe}from"node:fs";import{resolve as Sre}from"node:path";import wre from"node:process";var fi="stage_2.4",lM=5e3,jHe=3e4;function uM(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 FHe(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=Sre(e,r.path);if(!NHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??lM,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 vre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},MHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function FHe(t,e,r){let n=Math.min(e.length*lM,jHe),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(LHe(t,s,r))}return zHe(o)}function LHe(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("/")?Sre(t,a):a,u=lM,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 zHe(t){let e="skip";for(let o of t)vre[o.disposition]>vre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${MHe[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 UHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(UHe){let t=uM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}zr();Dn();Nn();import xre from"node:process";var i0="stage_3.1";function dM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:i0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var qHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xre.argv[1]}`;if(qHe){let t=dM();console.log(JSON.stringify(t)),xre.exit(t.exitCode)}GC();fM();pM();zr();t0();import{randomBytes as KHe}from"node:crypto";import{unlinkSync as JHe}from"node:fs";import{tmpdir as YHe}from"node:os";import{join as XHe}from"node:path";import hM from"node:process";sh();Nn();Ue();import{readFileSync as GHe}from"node:fs";import{resolve as Ere}from"node:path";function ZHe(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=Ere(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 VHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function WHe(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=VHe(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(Ere(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 mM(t,e){try{let r=ZHe(GHe(t,"utf8"));return r?WHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function Are(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Tre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Ore(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 QHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Are(n,i))return null;let o=n,s=i,a=nM(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(iM(u)==="fallback")return null;if(r){let d=mM(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 e6e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Tre(n,i))return null;let o=n,s=i,a=nM(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(iM(c)==="fallback")return null;if(r&&Ore(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 gM(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=Are(n,i),a=Tre(n,i),c=r&&s;if(rM()&&s){let d=QHe(t,e,c);if(d)return d}if(rM()&&a){let d=e6e(t,e);if(d)return d}let l,u=i;c&&(l=XHe(YHe(),`clad-vitest-${hM.pid}-${KHe(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&&Ore(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=mM(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{JHe(l)}catch{}}}var t6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hM.argv[1]}`;if(t6e){let t=gM();console.log(JSON.stringify(t)),hM.exit(t.exitCode)}zr();Dn();Nn();import Rre from"node:process";var a0="stage_3.3";function yM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:a0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:a0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(a0,i,s,o);return a||Xt(a0,s)}var r6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rre.argv[1]}`;if(r6e){let t=yM();console.log(JSON.stringify(t)),Rre.exit(t.exitCode)}VC();Zf();wa();bM();Up();_S();var Mre=wt(tr(),1);import{existsSync as vM,readFileSync as p6e,readdirSync as jre,statSync as m6e,writeFileSync as h6e}from"node:fs";import{basename as dh,join as fh,relative as Nre}from"node:path";var g6e=["self-dogfood:","fixture:","derived:"],Fre=/\.(test|spec)\.[jt]sx?$/;function Lre(t,e=t,r=[]){let n;try{n=jre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{m6e(o).isDirectory()?Lre(t,o,r):Fre.test(i)&&r.push(o)}catch{continue}}return r}function zre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!vM(e)||!vM(r))return{repaired:n,suggested:i};let o=Lre(r),s=new Map;for(let a of o){let c=Nre(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of jre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=p6e(c,"utf8"),u=(0,Mre.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(g6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(vM(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=>Nre(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Fre,"");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&&n6e(c,l,"utf8")}return{repaired:n,suggested:i}}kl();import{existsSync as o6e,readFileSync as s6e}from"node:fs";import{join as a6e}from"node:path";function c6e(t,e){let r=a6e(t,e);if(!o6e(r))return[];let n=[];for(let i of s6e(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 Cre(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=>c6e(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 Dre(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();un();Pi();un();kl();var vM=["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"],l6e=[...vM,"att"];function u6e(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 Xx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function d6e(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 d0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...vM.map(o=>u6e(i,o,e)),d6e(i,r,e)]}));return{columns:l6e,rows:n}}function Nre(t,e=".",r={}){let n=r.internal??!1,i=d0(t,e),o=[...vM.map(c=>n?c.replace("stage_",""):f6e(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 f6e(t){return Ra(t).slice(0,3)}async function HYe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(Kde(),Wde)),Promise.resolve().then(()=>(efe(),Qde)),Promise.resolve().then(()=>(cm(),uQ))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>zte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Fte(s,a,c),initialize:Nj,prepareClarify:(s,{cwd:a})=>Lte(a,s),clarify:Lj,resolveReview:(s,{cwd:a})=>Dte(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 BYe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await Nj({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)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&h6e(c,l,"utf8")}return{repaired:n,suggested:i}}El();import{existsSync as y6e,readFileSync as _6e}from"node:fs";import{join as b6e}from"node:path";function v6e(t,e){let r=b6e(t,e);if(!y6e(r))return[];let n=[];for(let i of _6e(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 Ure(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=>v6e(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 qre(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();un();Pi();un();El();var SM=["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"],S6e=[...SM,"att"];function w6e(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 Xx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function x6e(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 d0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...SM.map(o=>w6e(i,o,e)),x6e(i,r,e)]}));return{columns:S6e,rows:n}}function Hre(t,e=".",r={}){let n=r.internal??!1,i=d0(t,e),o=[...SM.map(c=>n?c.replace("stage_",""):$6e(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 $6e(t){return Ra(t).slice(0,3)}async function tXe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(nfe(),rfe)),Promise.resolve().then(()=>(cfe(),afe)),Promise.resolve().then(()=>(lm(),_Q))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Wte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Zte(s,a,c),initialize:jj,prepareClarify:(s,{cwd:a})=>Vte(a,s),clarify:zj,resolveReview:(s,{cwd:a})=>qte(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 rXe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await jj({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: `);for(let[o,s]of n.clarifyingQuestions.entries())H.stdout.write(` ${o+1}. ${s} @@ -947,36 +952,36 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&n6e(c,l,"u `),H.stdout.write(` e.g. clad init payment SaaS for B2B `),H.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));H.exit(0)}async function GYe(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(()=>(kfe(),$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=>yR(l,s)),c=`${jG(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 ZYe(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(".");ru(".",r),rc("."),RY(".");let n=cu(".");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=Pre(".");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=u0(".");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 VYe(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 WYe(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.exit(0)}async function nXe(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(()=>(Cfe(),Pfe)),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=>yR(l,s)),c=`${MG(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 iXe(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(".");nu(".",r),rc("."),IY(".");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=zre(".");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=u0(".");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 oXe(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 sXe(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 KYe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await OC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function JYe(){L("note","update","reconciling the current project after the engine upgrade");let t=await N7(".",{wireHosts:async()=>(await OC({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(` +`),H.exit(0)}async function aXe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await OC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function cXe(){L("note","update","reconciling the current project after the engine upgrade");let t=await H7(".",{wireHosts:async()=>(await OC({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): -`),FA({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 YYe={"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 FA(t){let e=t.tier??"all",r=t.silent===!0,n=YYe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",iM],["stage_1.5",ac],["stage_1.6",rm],["stage_2.1",()=>hM({...i,strict:t.strict})],["stage_2.2",()=>oM(i)],["stage_2.3",BC],["stage_2.4",lM],["stage_3.1",uM],["stage_3.2",aM],["stage_3.3",gM],["stage_4.1",Qj],["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("."),ore(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=vX(p);mr(h)&&(c=!0,a=Math.max(a,SX(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)&&oXe(p))}}finally{rb(),are()}if(t.strict)try{let d=q();for(let f of nre(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{sZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:iZ(RS)})&&(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:IS(u),stopFingerprint:wX(u)}),{worst:a,anyFailed:c,stages:u}}function XYe(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 QYe(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 eXe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=OS(e,o=>{try{return Efe(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 tXe(t={}){try{if(t.sessions){Hte(t);return}if(t.trend!==void 0&&t.trend!==!1){Bte(t);return}let e=q(),n=tG(e,o=>{try{return Efe(o,"utf8")}catch{return null}},"."),i=nG(".",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)}`,` ${bl}`];H.stdout.write(`${c.join(` +`),FA({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 lXe={"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 FA(t){let e=t.tier??"all",r=t.silent===!0,n=lXe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",oM],["stage_1.5",ac],["stage_1.6",nm],["stage_2.1",()=>gM({...i,strict:t.strict})],["stage_2.2",()=>sM(i)],["stage_2.3",BC],["stage_2.4",uM],["stage_3.1",dM],["stage_3.2",cM],["stage_3.3",yM],["stage_4.1",eM],["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("."),pre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=SX(p);mr(h)&&(c=!0,a=Math.max(a,wX(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)&&yXe(p))}}finally{rb(),hre()}if(t.strict)try{let d=q();for(let f of dre(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{aZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:oZ(RS)})&&(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:IS(u),stopFingerprint:xX(u)}),{worst:a,anyFailed:c,stages:u}}function uXe(t){try{let e=q(),r=bl(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 dXe(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 fXe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=OS(e,o=>{try{return Dfe(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 pXe(t={}){try{if(t.sessions){Yte(t);return}if(t.trend!==void 0&&t.trend!==!1){Xte(t);return}let e=q(),n=rG(e,o=>{try{return Dfe(o,"utf8")}catch{return null}},"."),i=iG(".",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)}`,` ${vl}`];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 rXe(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=FA({...t,focusModules:e});if(!t.json){let n=n7(".");n&&H.stdout.write(`\u2139 ${n} -`)}H.exitCode=r.worst}function nXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=KX(".",t,{checkStages:FA,onIndex:rc,gitOpInProgress:LO,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 iXe(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=NY(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. +`),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 mXe(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=FA({...t,focusModules:e});if(!t.json){let n=d7(".");n&&H.stdout.write(`\u2139 ${n} +`)}H.exitCode=r.worst}function hXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=n7(".",t,{checkStages:FA,onIndex:rc,gitOpInProgress:LO,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 gXe(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=jY(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=Cre(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(`${Dre(i)} -`),H.exit(0)}function oXe(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=I4(Ia(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] +`),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=Ure(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(`${qre(i)} +`),H.exit(0)}function yXe(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=P4(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(` -`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${I4(l,160)} +`).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${P4(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) `),t.hint&&H.stdout.write(` fix: run \`${t.hint}\` `);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(` ${I4(r,160)} +`).map(r=>r.trim()).filter(r=>r.length>0);for(let r of e.slice(0,5))H.stdout.write(` ${P4(r,160)} `);e.length>5&&H.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` -`)}}function I4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function sXe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(d0(e,"."),null,2)} -`),H.exitCode=0;return}H.stdout.write(`${Nre(e,".",{internal:t.internal})} -`),H.exit(0)}function aXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function cXe(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=d0(i,e),s={gitHead:xa(e),version:fn(),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=KG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{qYe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${aXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function lXe(t){let e=nT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function uXe(){let t=new G4;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(BYe),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(GYe),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(ZYe),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(KYe),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(JYe),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(rXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(VYe),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(nXe),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)=>iXe(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(WYe),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(sXe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(XYe),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)=>QYe(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=>R7(r,{checkStages:FA})),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=>eXe(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=>tXe(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=>ere(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>tre()),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=>{rre(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=>NG(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=>bX(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=>cXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(lXe),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(x7),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(HYe),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){GX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}jX(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(Mte),t}var dXe=!!globalThis.__CLADDING_BUNDLED,fXe=dXe||import.meta.url===`file://${H.argv[1]}`;fXe&&uXe().parse();export{YYe as TIER_STAGES,uXe as createProgram,cXe as runBundleCommand,rXe as runCheckCommand,FA as runCheckStages,VYe as runCheckpointCommand,XYe as runContextCommand,nXe as runDoneCommand,QYe as runImpactCommand,eXe as runInferDepsCommand,BYe as runInitCommand,tXe as runMeasureCommand,iXe as runOracleCommand,WYe as runRollbackCommand,lXe as runRouteCommand,GYe as runRunCommand,HYe as runServeCommand,KYe as runSetupCommand,sXe as runStatusCommand,ZYe as runSyncCommand,JYe as runUpdateCommand}; +`)}}function P4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function _Xe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(d0(e,"."),null,2)} +`),H.exitCode=0;return}H.stdout.write(`${Hre(e,".",{internal:t.internal})} +`),H.exit(0)}function bXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function vXe(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=d0(i,e),s={gitHead:xa(e),version:fn(),generatedAt:t.now??new Date().toISOString()},a=xl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Sl(u),auditMarkdown:wl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=JG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{eXe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${bXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function SXe(t){let e=nT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function wXe(){let t=new Z4;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(rXe),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(nXe),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(iXe),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(aXe),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(cXe),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(mXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(oXe),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(hXe),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)=>gXe(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(sXe),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(_Xe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(uXe),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)=>dXe(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=>F7(r,{checkStages:FA})),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=>fXe(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=>pXe(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=>cre(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>lre()),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=>{ure(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=>jG(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=>vX(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=>vXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(SXe),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(I7),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(tXe),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){QX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}HX(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(Gte),t}var xXe=!!globalThis.__CLADDING_BUNDLED,$Xe=xXe||import.meta.url===`file://${H.argv[1]}`;$Xe&&wXe().parse();export{lXe as TIER_STAGES,wXe as createProgram,vXe as runBundleCommand,mXe as runCheckCommand,FA as runCheckStages,oXe as runCheckpointCommand,uXe as runContextCommand,hXe as runDoneCommand,dXe as runImpactCommand,fXe as runInferDepsCommand,rXe as runInitCommand,pXe as runMeasureCommand,gXe as runOracleCommand,sXe as runRollbackCommand,SXe as runRouteCommand,nXe as runRunCommand,tXe as runServeCommand,aXe as runSetupCommand,_Xe as runStatusCommand,iXe as runSyncCommand,cXe as runUpdateCommand}; diff --git a/spec.yaml b/spec.yaml index 316a1b4c..70381494 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: 279 + features: 280 scenarios: 2 capabilities: 6 - test_files: 256 + test_files: 257 diff --git a/spec/attestation.yaml b/spec/attestation.yaml index a1572503..f2e4c70b 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -22,16 +22,16 @@ policy: attested_modules: .claude/settings.json: 08a64351770badf4 .github/workflows/ci.yml: 8ea99219cb80df60 - .gitignore: 1294975ba3b47043 + .gitignore: d311656aff3813ca CHANGELOG.md: 78288e943090a029 CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: bcfa2b3d93de7f56 - README.ja.md: 072d19e94604f165 - README.ko.html: d54456b6aa795341 - README.ko.md: 53875c680af622d3 - README.md: 87a865c94c73ebf8 - README.zh.md: 09ee2df6c5c36872 + README.html: f6403bfe696dad0a + README.ja.md: c356a1bb47f09704 + README.ko.html: c8ab0b905cf72c6e + README.ko.md: 166b7013ec751549 + README.md: 4b2a0103093f338b + README.zh.md: 4de9ba6f9fb14de1 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: 9937e09b6401f878 + spec.yaml: 92fb4b9e3ef75577 spec/README.md: 7c257426396d435c spec/architecture.yaml: f0888480405a13a8 spec/features/: a4d0f0eb87fed960 @@ -160,7 +160,7 @@ attested_modules: src/cli/clad.ts: dc3a50b14786e23b src/cli/clarify.ts: f17177969d5b75ff src/cli/doctor-hosts.ts: 1f0c2cec5a310b81 - src/cli/doctor.ts: ae209b607848a8a2 + src/cli/doctor.ts: 50d904fdbfe7e942 src/cli/done.ts: 4a5dd13769252f51 src/cli/enforcement-advisory.ts: 395c5be696e88b5c src/cli/graph-serve.ts: 23e6e389225d0f98 @@ -168,7 +168,7 @@ attested_modules: src/cli/hook-health.ts: e103afb67ecde8bb src/cli/hook.ts: 59a2f8dbcfbd2c60 src/cli/host-onboarding.ts: b046571d4be7280c - src/cli/init.ts: 2a7e26ae4ea44239 + src/cli/init.ts: b074f84900f3e10c src/cli/intent-from-path.ts: e69862821d979f22 src/cli/measure.ts: 3a562f16589e26c2 src/cli/report.ts: ee7d35b6c36dfa76 @@ -219,6 +219,7 @@ attested_modules: src/hitl/independence.ts: 202f4e5ef8bc69e3 src/init/agents-md.ts: 5369a15847ce1ae7 src/init/git-hook.ts: b77910b0df392cbf + src/init/gitignore-policy.ts: 2c3f278e8779e0c6 src/init/host-instructions.ts: c598f8598d8d1cd4 src/init/host-setup.ts: d4d7c55f16e43dc3 src/optimizer: a4d0f0eb87fed960 @@ -244,7 +245,7 @@ attested_modules: src/report/sarif.ts: 71e97aceeb0a4473 src/router: a4d0f0eb87fed960 src/router/intent.ts: 430590f761b891a6 - src/serve/server.ts: ac4f9c542ff0bb32 + src/serve/server.ts: 6a46b2ee32229b7c src/spec: a4d0f0eb87fed960 src/spec/attestation.ts: bacd18efacb55615 src/spec/cli.ts: 7a9bcd0f66677810 @@ -353,7 +354,7 @@ attested_modules: tests/cli/benchmark.test.ts: b4a87289605ee75f tests/cli/clad.test.ts: 4413920b79b15ee0 tests/cli/gate-golden-matrix.test.ts: 81d88e1cd40723fa - tests/cli/init.test.ts: cc0bdbcb826ed2bd + tests/cli/init.test.ts: e88394472a0b95b3 tests/cli/intent-onboarding.test.ts: 0681b98ce2e74c22 tests/conformance/registry.test.ts: 018b1e5c0d8d4baf tests/drive/loop.test.ts: ae49bcfa745a8cdb @@ -655,6 +656,7 @@ attested_features: F-af45042a: ok F-af96b1: ok F-b010427b: ok + F-b0c2e724: ok F-b0c8ba2c: ok F-b0f898a6: ok F-b2094740: ok diff --git a/spec/features/gate-config-committable-b0c2e724.yaml b/spec/features/gate-config-committable-b0c2e724.yaml new file mode 100644 index 00000000..12f0a676 --- /dev/null +++ b/spec/features/gate-config-committable-b0c2e724.yaml @@ -0,0 +1,49 @@ +id: F-b0c2e724 +slug: gate-config-committable +title: "Gate config survives a fresh clone: committable .cladding/config.yaml" +status: done +modules: + - src/init/gitignore-policy.ts + - src/cli/init.ts + - src/cli/doctor.ts +acceptance_criteria: + - id: AC-2e9c61f8 + ears: event + condition: "when clad init manages the .gitignore entry for cladding runtime state and no cladding entry exists yet" + action: "write the contents-exclusion pair `.cladding/*` plus `!.cladding/config.yaml` instead of the directory exclusion" + response: "the gate configuration (scope, commands, coverage, test_report) can be committed, so a fresh clone and CI see the same gate the author tuned — a directory exclusion makes re-inclusion impossible by git semantics, which silently discarded every declared gate override" + text: "When clad init writes the cladding ignore entry, the system shall write `.cladding/*` and `!.cladding/config.yaml` so the gate config file is committable while runtime state stays ignored." + notes: | + ## Why + Measured live: the strict gate is CI's reason to exist, yet the one file + that tunes it was unignorable-in-reverse — `.cladding/` (directory form) + blocks `!.cladding/config.yaml` re-inclusion entirely, so every documented + gate.commands recommendation produced local-only configuration. Found by a + live host run during the gate.language E2E and verified with + git check-ignore. + test_refs: ["tests/cli/gitignore-gate-config.test.ts", "tests/cli/init.test.ts"] + - id: AC-6a58f0d1 + ears: unwanted + condition: "if the project's .gitignore already carries a cladding entry — the legacy `.cladding/` directory form or the new pair" + action: "leave the file byte-identical" + response: "repeated init stays idempotent and no adopter's hand-tuned ignore file is rewritten behind their back" + text: "If a cladding ignore entry already exists in any recognized form, the system shall not modify .gitignore." + test_refs: ["tests/cli/gitignore-gate-config.test.ts", "tests/cli/init.test.ts"] + - id: AC-d47b93c5 + ears: event + condition: "when clad doctor inspects a project whose root .gitignore blocks .cladding/config.yaml from being committed" + action: "report the blocked gate config in both text and JSON while continuing to exit successfully" + response: "existing adopters with the legacy directory exclusion learn their gate config is local-only and how to fix it, through a read-only diagnosis that never rewrites their file — the same posture as the unpinned-CI report" + text: "When the root .gitignore blocks the gate config from being committed, clad doctor shall report it in text and JSON and still exit zero." + test_refs: ["tests/cli/gitignore-gate-config.test.ts", "tests/cli/doctor.test.ts"] + - id: AC-f30a7c62 + ears: ubiquitous + action: "expose the ignore-entry rendering and the blocked-status classification as pure exported functions" + response: "the contract is testable without a git repository or a built binary, and git check-ignore agreement is proven once against the rendered content" + text: "The system shall expose pure functions that render the managed ignore entry and classify a .gitignore text as commitable, blocked, or absent for the gate config." + test_refs: ["tests/cli/gitignore-gate-config.test.ts"] +design_impact: + classification: none + rationale: "Changes one scaffold line, adds a read-only doctor diagnosis; no gate policy, architecture, or capability change." + status: resolved + artifacts: [] diff --git a/spec/index.yaml b/spec/index.yaml index 9a75e26a..4b12c5a6 100644 --- a/spec/index.yaml +++ b/spec/index.yaml @@ -214,6 +214,7 @@ features: F-af45042a: {slug: graph-live-health, status: done, modules: 5} F-af96b1: {slug: no-vacuous-green-gate-contract, status: done, modules: 14} F-b010427b: {slug: detector-layer-purity, status: done, modules: 2} + F-b0c2e724: {slug: gate-config-committable, status: done, modules: 3} F-b0c8ba2c: {slug: gate-no-progress, status: done, modules: 1} F-b0f898a6: {slug: attestation-v2-per-module, status: done, modules: 3} F-b2094740: {slug: lint-config-detection, status: done, modules: 1} diff --git a/src/cli/doctor.ts b/src/cli/doctor.ts index ff0fc6e9..6db1258d 100644 --- a/src/cli/doctor.ts +++ b/src/cli/doctor.ts @@ -15,7 +15,7 @@ // so it stays a peer surface that adopters reach for diagnostics, not // a gate. -import {existsSync} from 'node:fs'; +import {existsSync, readFileSync} from 'node:fs'; import {join} from 'node:path'; import process from 'node:process'; @@ -31,6 +31,7 @@ import { } from '../core/telemetry-summary.js'; import {HOOK_EVENTS, readHookHealth, type HookEventName, type HookHealthReport} from './hook-health.js'; import {readCiVersionHealth, type CiVersionHealth} from './ci-version.js'; +import {gateConfigIgnoreStatus, type GateConfigIgnoreStatus} from '../init/gitignore-policy.js'; export interface DoctorCommandOptions { readonly cwd?: string; @@ -49,6 +50,8 @@ export interface DoctorReport { readonly hooks: HookHealthReport; /** Read-only diagnosis of floating Cladding package selectors in CI. */ readonly ciVersion: CiVersionHealth; + /** Whether the root .gitignore lets `.cladding/config.yaml` reach CI and fresh clones. */ + readonly gateConfigIgnore: GateConfigIgnoreStatus; } export interface GovernanceSummary { @@ -104,7 +107,8 @@ export function runDoctorCommand(opts: DoctorCommandOptions = {}): void { const governance = summarizeGovernance(cwd, events); const hooks = readHookHealth(cwd); const ciVersion = readCiVersionHealth(cwd); - const report: DoctorReport = {cwd, events: eventCounts, sentinelMiss, governance, hooks, ciVersion}; + const gateConfigIgnore = readGateConfigIgnoreStatus(cwd); + const report: DoctorReport = {cwd, events: eventCounts, sentinelMiss, governance, hooks, ciVersion, gateConfigIgnore}; if (opts.json) { process.stdout.write(`${JSON.stringify(report, null, 2)}\n`); @@ -120,6 +124,7 @@ export function runDoctorCommand(opts: DoctorCommandOptions = {}): void { ); renderHookHealth(report.hooks); renderCiVersionHealth(report.ciVersion); + renderGateConfigIgnore(report.gateConfigIgnore); process.exit(0); return; } @@ -148,6 +153,7 @@ function renderTextReport(report: DoctorReport): void { renderHookHealth(report.hooks); renderCiVersionHealth(report.ciVersion); + renderGateConfigIgnore(report.gateConfigIgnore); // F-95a096 — the governance ledger, readable without parsing JSONL by hand. // Rendered before the sentinel-miss early return: gate/done/stop state is @@ -198,6 +204,26 @@ function renderTextReport(report: DoctorReport): void { process.stdout.write('Tune your host: raise max_tokens, switch model, or check MCP transport health.\n'); } +/** + * Reads the root `.gitignore` (absent file included) and classifies whether the + * gate config can be committed. Read-only, like every doctor diagnosis: the + * adopter's ignore file is never rewritten from here. + */ +function readGateConfigIgnoreStatus(cwd: string): GateConfigIgnoreStatus { + const path = join(cwd, '.gitignore'); + return gateConfigIgnoreStatus(existsSync(path) ? readFileSync(path, 'utf8') : null); +} + +// Quiet unless the gate config is unreachable — a working ignore file needs no +// commentary, and a blocked one costs the adopter their whole gate tuning in CI. +function renderGateConfigIgnore(status: GateConfigIgnoreStatus): void { + if (status !== 'blocked') return; + process.stdout.write( + '\ngate config: .gitignore blocks .cladding/config.yaml — CI and fresh clones cannot see your gate ' + + "overrides. Change '.cladding/' to '.cladding/*' + '!.cladding/config.yaml'.\n", + ); +} + function renderCiVersionHealth(health: CiVersionHealth): void { if (health.unpinnedWorkflows.length === 0) return; process.stdout.write('\nCI version pinning\n'); diff --git a/src/cli/init.ts b/src/cli/init.ts index d6b91e98..91b4ec1f 100644 --- a/src/cli/init.ts +++ b/src/cli/init.ts @@ -3,7 +3,9 @@ // One command, three side-effects on a fresh directory: // 1. spec.yaml seed with one placeholder feature (F-001) // 2. .cladding/ runtime dir (audit + events log live here) -// 3. .gitignore + .gitattributes managed-line append (only when missing) +// 3. .gitignore + .gitattributes managed-entry append (only when missing) — +// the ignore entry keeps runtime state untracked while leaving +// .cladding/config.yaml committable, so CI sees the tuned gate // // Idempotent by default — re-running on an initialised workspace is a // no-op except for reporting. `--force` overwrites the seed spec.yaml @@ -37,6 +39,7 @@ import {captureArtifactDigests, loadState, saveState, type OnboardingState} from import {claddingMajorMinor} from './ci-version.js'; import {detectToolchain} from '../stages/toolchain/detect.js'; import {writeSpecDrivenAgentsMd} from '../init/agents-md.js'; +import {CLADDING_IGNORE_BLOCK, hasCladdingIgnoreEntry} from '../init/gitignore-policy.js'; import {getCurrentCladdingVersion, getLastSetupVersion} from '../init/host-setup.js'; import {installGitHook} from '../init/git-hook.js'; import {loadIntentFromPathIfApplicable} from './intent-from-path.js'; @@ -259,12 +262,18 @@ function specSeed( ].join('\n'); } -function appendIfMissing(path: string, marker: string, line: string, heading: string): boolean { +/** Appends a managed block to a user-owned file, never disturbing what is already there. */ +function appendManagedBlock(path: string, block: string): void { const existing = existsSync(path) ? readFileSync(path, 'utf8') : ''; - if (existing.split(/\r?\n/).some((existingLine) => existingLine.trim() === marker)) return false; const ensureNewline = existing.length > 0 && !existing.endsWith('\n') ? '\n' : ''; const sectionGap = existing.length > 0 ? '\n' : ''; - writeFileSync(path, `${existing}${ensureNewline}${sectionGap}${heading}\n${line}\n`); + writeFileSync(path, `${existing}${ensureNewline}${sectionGap}${block}`); +} + +function appendIfMissing(path: string, marker: string, line: string, heading: string): boolean { + const existing = existsSync(path) ? readFileSync(path, 'utf8') : ''; + if (existing.split(/\r?\n/).some((existingLine) => existingLine.trim() === marker)) return false; + appendManagedBlock(path, `${heading}\n${line}\n`); return true; } @@ -491,13 +500,22 @@ export async function runInit(opts: InitOptions = {}): Promise { created.push('.cladding/'); } - // 3. .gitignore append + // 3. .gitignore append — runtime state ignored, gate config committable. + // + // The entry is the contents-exclusion pair `.cladding/*` + `!.cladding/config.yaml`, + // never the directory exclusion `.cladding/`: git cannot re-include a file whose + // parent directory is excluded, which silently made every declared gate override + // (scope, commands, coverage, test_report) local-only. Any recognized entry that + // already exists — including the legacy directory form — leaves the file + // byte-identical; adopters are told about it by `clad doctor`, not migrated behind + // their back. const gitignorePath = join(cwd, '.gitignore'); - const appended = appendIfMissing(gitignorePath, '.cladding/', '.cladding/', '# Cladding runtime state'); - if (appended) { - created.push('.gitignore (.cladding/ entry appended)'); + const existingGitignore = existsSync(gitignorePath) ? readFileSync(gitignorePath, 'utf8') : ''; + if (hasCladdingIgnoreEntry(existingGitignore)) { + skipped.push('.gitignore (cladding entry already present)'); } else { - skipped.push('.gitignore (.cladding/ entry already present)'); + appendManagedBlock(gitignorePath, CLADDING_IGNORE_BLOCK); + created.push('.gitignore (.cladding/* ignored, .cladding/config.yaml committable)'); } // F-caff8598 — the append-mostly feature index is safe under union merge; diff --git a/src/init/gitignore-policy.ts b/src/init/gitignore-policy.ts new file mode 100644 index 00000000..62026399 --- /dev/null +++ b/src/init/gitignore-policy.ts @@ -0,0 +1,125 @@ +// Cladding · .gitignore policy for the `.cladding/` runtime directory +// +// Why this module exists: `.cladding/` holds two kinds of file with opposite +// fates. Runtime state (events.log.jsonl, stop-block.json, scan proposals) is +// per-developer noise that must stay untracked. The gate configuration +// (`.cladding/config.yaml` — scope, commands, coverage, test_report) is a +// project decision that CI and every fresh clone must see; the strict gate is +// CI's reason to exist, so losing its tuning silently is the worst outcome. +// +// Git cannot separate the two from a *directory* exclusion. Once a pattern +// excludes a directory, git never descends into it, so a later +// `!.cladding/config.yaml` re-include is unreachable and the file stays +// ignored no matter what follows it. Only the contents form `.cladding/*` +// leaves the directory itself un-excluded, which is what makes the negation +// effective. Verified with `git check-ignore` before this module existed: +// every documented gate override was silently local-only. +// +// Pure by design (F-b0c2e724 AC-f30a7c62): rendering the managed entry and +// classifying an existing file are string operations, so the contract is +// testable without a git repository or a built binary, and the one place that +// needs git agreement is proven once against the rendered content. + +/** + * The managed ignore block `clad init` writes for a project that has no + * cladding entry yet: runtime state ignored, gate config committable. + */ +export const CLADDING_IGNORE_BLOCK = '# Cladding runtime state\n.cladding/*\n!.cladding/config.yaml\n'; + +/** + * Whether `.cladding/config.yaml` can be committed under a given `.gitignore`. + * + * - `commitable` — nothing ignores the gate config (no cladding entry at all, + * or the contents form followed by the re-include). + * - `blocked` — the gate config is ignored, so CI and fresh clones cannot see it. + * - `absent` — there is no `.gitignore` file to classify. + */ +export type GateConfigIgnoreStatus = 'commitable' | 'blocked' | 'absent'; + +/** Ignore lines this project recognizes as "the cladding entry", in any generation. */ +const RECOGNIZED_ENTRIES: ReadonlySet = new Set(['.cladding/', '.cladding', '.cladding/*']); + +/** + * Directory-matching forms. Both exclude the directory itself, and git never + * descends into an excluded directory — so no later negation can re-include a + * child. Conservative by design: a hand-crafted file that first excludes the + * directory and then un-excludes it is reported blocked, which only ever + * advises a clearer rewrite. + */ +const DIRECTORY_FORMS: ReadonlySet = new Set(['.cladding/', '.cladding']); + +/** The contents form — excludes children while leaving the directory itself walkable. */ +const CONTENTS_FORM = '.cladding/*'; + +/** The negation that re-includes the gate config; only effective after {@link CONTENTS_FORM}. */ +const GATE_CONFIG_REINCLUDE = '!.cladding/config.yaml'; + +/** + * Trimmed, non-empty, non-comment lines — the only ones git treats as patterns. + */ +function patternLines(text: string): string[] { + return text + .split(/\r?\n/) + .map((line) => line.trim()) + .filter((line) => line.length > 0 && !line.startsWith('#')); +} + +/** + * Whether a `.gitignore` text already carries a cladding ignore entry in any + * recognized generation (`.cladding/`, `.cladding`, or `.cladding/*`). + * + * Used by `clad init` to stay idempotent: when this is true the file is left + * byte-identical, so no adopter's hand-tuned ignore file is rewritten behind + * their back and no migration happens without being asked. + * + * @param gitignoreText - Full text of a `.gitignore`; `''` for an absent file. + * @returns True when a recognized entry is present on its own pattern line. + * @throws Never. + * @example + * ```ts + * hasCladdingIgnoreEntry('node_modules/\n.cladding/\n'); // true (legacy form) + * hasCladdingIgnoreEntry('# .cladding/\n'); // false (comment) + * ``` + * @see spec/features/gate-config-committable-b0c2e724.yaml AC-6a58f0d1 + * @since 0.9.4 + */ +export function hasCladdingIgnoreEntry(gitignoreText: string): boolean { + return patternLines(gitignoreText).some((line) => RECOGNIZED_ENTRIES.has(line)); +} + +/** + * Classifies whether a `.gitignore` lets `.cladding/config.yaml` be committed. + * + * Follows git's own resolution order: the directory forms are terminal (git + * cannot re-include a file whose parent directory is excluded), while the + * contents form is only safe when the re-include comes *after* it — a later + * pattern wins in git, so `!.cladding/config.yaml` above `.cladding/*` is dead. + * + * @param gitignoreText - Full text of the root `.gitignore`, or null/undefined when the file does not exist. + * @returns `absent` for no file, `blocked` when the gate config is ignored, `commitable` otherwise. + * @throws Never; every input maps to a status. + * @example + * ```ts + * gateConfigIgnoreStatus(CLADDING_IGNORE_BLOCK); // 'commitable' + * gateConfigIgnoreStatus('.cladding/\n'); // 'blocked' + * gateConfigIgnoreStatus(null); // 'absent' + * ``` + * @see spec/features/gate-config-committable-b0c2e724.yaml AC-d47b93c5, AC-f30a7c62 + * @since 0.9.4 + */ +export function gateConfigIgnoreStatus(gitignoreText: string | null | undefined): GateConfigIgnoreStatus { + if (gitignoreText === null || gitignoreText === undefined) return 'absent'; + + const lines = patternLines(gitignoreText); + let contentsAt = -1; + let reincludeAt = -1; + for (const [index, line] of lines.entries()) { + if (DIRECTORY_FORMS.has(line)) return 'blocked'; + if (line === CONTENTS_FORM) contentsAt = index; + else if (line === GATE_CONFIG_REINCLUDE) reincludeAt = index; + } + + // No contents exclusion at all → nothing ignores the gate config. + if (contentsAt === -1) return 'commitable'; + return reincludeAt > contentsAt ? 'commitable' : 'blocked'; +} diff --git a/src/serve/server.ts b/src/serve/server.ts index e064b780..3541d536 100644 --- a/src/serve/server.ts +++ b/src/serve/server.ts @@ -703,7 +703,7 @@ function registerTools(server: McpServer, cwd: string, onboarding?: OnboardingOp 'Create spec.yaml, spec/architecture.yaml, and spec/capabilities.yaml.', 'Create 1-3 spec/scenarios/*.yaml journey files.', 'Create docs/project-context.md and docs/conventions.md.', - 'Create .cladding/onboarding/state.yaml and append .cladding/ to .gitignore.', + 'Create .cladding/onboarding/state.yaml and append the .cladding/* ignore pair (config.yaml stays committable).', 'Create a managed AGENTS.md block; preserve an existing unmanaged AGENTS.md.', 'Preserve any existing CLAUDE.md unchanged; AGENTS.md is the shared host instruction surface.', ], diff --git a/tests/cli/doctor.test.ts b/tests/cli/doctor.test.ts index caf9ad9e..b09dba8e 100644 --- a/tests/cli/doctor.test.ts +++ b/tests/cli/doctor.test.ts @@ -7,7 +7,7 @@ // readEvents would test less than the file-based path. import {afterEach, beforeEach, describe, expect, test, vi} from 'vitest'; -import {appendFileSync, mkdirSync, mkdtempSync, rmSync, writeFileSync} from 'node:fs'; +import {appendFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync} from 'node:fs'; import {tmpdir} from 'node:os'; import {join} from 'node:path'; @@ -43,6 +43,10 @@ function seedHookHealth(cwd: string): void { ); } +function seedGitignore(cwd: string, body: string): void { + writeFileSync(join(cwd, '.gitignore'), body, 'utf8'); +} + function seedWorkflow(cwd: string, name: string, body: string): void { mkdirSync(join(cwd, '.github', 'workflows'), {recursive: true}); writeFileSync(join(cwd, '.github', 'workflows', name), body, 'utf8'); @@ -194,6 +198,52 @@ describe('clad doctor handler', () => { }); }); + // F-b0c2e724 — the legacy directory exclusion makes .cladding/config.yaml + // uncommittable, so the gate an author tuned never reaches CI or a fresh + // clone. Doctor diagnoses it read-only; it never rewrites the ignore file. + test('reports a blocked gate config in text and JSON without failing', () => { + seedGitignore(dir, 'node_modules/\n.cladding/\n'); + seedEvents(dir, [ + {id: '1', timestamp: 't', type: 'feature_checkpoint', payload: {featureId: 'F-a0000001'}}, + ]); + runDoctorCommand({cwd: dir}); + expect(exitCalls).toEqual([0]); + const out = stdoutChunks.join(''); + expect(out).toContain('gate config'); + expect(out).toContain('blocks .cladding/config.yaml'); + expect(out).toContain('.cladding/*'); + expect(out).toContain('!.cladding/config.yaml'); + // Read-only diagnosis: the adopter's file is untouched. + expect(readFileSync(join(dir, '.gitignore'), 'utf8')).toBe('node_modules/\n.cladding/\n'); + + exitCalls = []; + stdoutChunks = []; + runDoctorCommand({cwd: dir, json: true}); + expect(exitCalls).toEqual([0]); + expect(JSON.parse(stdoutChunks.join('')).gateConfigIgnore).toBe('blocked'); + }); + + test('keeps a committable gate config quiet while still reporting it in JSON', () => { + seedGitignore(dir, '# Cladding runtime state\n.cladding/*\n!.cladding/config.yaml\n'); + seedEvents(dir, [ + {id: '1', timestamp: 't', type: 'feature_checkpoint', payload: {featureId: 'F-a0000001'}}, + ]); + runDoctorCommand({cwd: dir}); + expect(exitCalls).toEqual([0]); + expect(stdoutChunks.join('')).not.toContain('gate config'); + + exitCalls = []; + stdoutChunks = []; + runDoctorCommand({cwd: dir, json: true}); + expect(JSON.parse(stdoutChunks.join('')).gateConfigIgnore).toBe('commitable'); + }); + + test('a project with no .gitignore reports an absent status and stays quiet', () => { + runDoctorCommand({cwd: dir, json: true}); + expect(exitCalls).toEqual([0]); + expect(JSON.parse(stdoutChunks.join('')).gateConfigIgnore).toBe('absent'); + }); + test('keeps pinned CI quiet', () => { seedWorkflow(dir, 'cladding.yaml', 'steps:\n - run: npx --yes cladding@0.9 check --strict\n'); runDoctorCommand({cwd: dir}); diff --git a/tests/cli/gitignore-gate-config.test.ts b/tests/cli/gitignore-gate-config.test.ts new file mode 100644 index 00000000..af16d7e4 --- /dev/null +++ b/tests/cli/gitignore-gate-config.test.ts @@ -0,0 +1,186 @@ +// Cladding · impl-blind oracle for F-b0c2e724 — authored from the spec contract only. +// +// The author of this file had no access to src/init/gitignore-policy.ts (no Read, +// Grep, Glob). Every assertion below is derived from the written acceptance +// contract for F-b0c2e724 (committable gate config) and from git's own behaviour, +// which is exercised live via execSync in a throwaway repository. + +import {execSync} from 'node:child_process'; +import {mkdtempSync, mkdirSync, rmSync, writeFileSync} from 'node:fs'; +import {tmpdir} from 'node:os'; +import {join} from 'node:path'; +import {afterAll, beforeAll, describe, expect, it} from 'vitest'; + +import { + CLADDING_IGNORE_BLOCK, + gateConfigIgnoreStatus, + hasCladdingIgnoreEntry, +} from '../../src/init/gitignore-policy.js'; + +/** + * The contract states these accept text that may be null/undefined. Bind through + * locally-widened aliases so the oracle exercises the documented inputs without + * depending on the implementation's exact parameter annotations. + */ +const statusOf = gateConfigIgnoreStatus as (text?: string | null) => string; +const hasEntry = hasCladdingIgnoreEntry as (text?: string | null) => boolean; + +const blockLines = (): string[] => + String(CLADDING_IGNORE_BLOCK) + .split('\n') + .map((line) => line.trim()); + +describe('F-b0c2e724 · CLADDING_IGNORE_BLOCK shape', () => { + it('contains a `.cladding/*` line', () => { + expect(blockLines()).toContain('.cladding/*'); + }); + + it('contains `!.cladding/config.yaml` AFTER the `.cladding/*` line', () => { + const lines = blockLines(); + const star = lines.indexOf('.cladding/*'); + const reinclude = lines.indexOf('!.cladding/config.yaml'); + expect(star).toBeGreaterThanOrEqual(0); + expect(reinclude).toBeGreaterThanOrEqual(0); + expect(reinclude).toBeGreaterThan(star); + }); + + it('does NOT contain a bare `.cladding/` directory-exclusion line', () => { + expect(blockLines()).not.toContain('.cladding/'); + expect(blockLines()).not.toContain('.cladding'); + }); +}); + +describe('F-b0c2e724 · gateConfigIgnoreStatus', () => { + it('reports "absent" for null', () => { + expect(statusOf(null)).toBe('absent'); + }); + + it('reports "absent" for undefined', () => { + expect(statusOf(undefined)).toBe('absent'); + }); + + it('reports "commitable" when no cladding-related line is present', () => { + const text = ['node_modules/', 'dist/', '*.log', '.DS_Store', ''].join('\n'); + expect(statusOf(text)).toBe('commitable'); + }); + + it('reports "commitable" for `.cladding/*` followed later by `!.cladding/config.yaml`', () => { + const text = ['node_modules/', '.cladding/*', '', '!.cladding/config.yaml', ''].join('\n'); + expect(statusOf(text)).toBe('commitable'); + }); + + it('reports "blocked" for `.cladding/` alone', () => { + const text = ['node_modules/', '.cladding/', ''].join('\n'); + expect(statusOf(text)).toBe('blocked'); + }); + + it('reports "blocked" for `.cladding/` PLUS `!.cladding/config.yaml` (git cannot re-include under an excluded directory)', () => { + const text = ['.cladding/', '!.cladding/config.yaml', ''].join('\n'); + expect(statusOf(text)).toBe('blocked'); + }); + + it('reports "blocked" for bare `.cladding` alone', () => { + const text = ['dist/', '.cladding', ''].join('\n'); + expect(statusOf(text)).toBe('blocked'); + }); + + it('reports "blocked" for `.cladding/*` alone with no re-include', () => { + const text = ['dist/', '.cladding/*', ''].join('\n'); + expect(statusOf(text)).toBe('blocked'); + }); + + it('reports "commitable" when the only mention is a `#` comment', () => { + const text = ['node_modules/', '# .cladding/', ''].join('\n'); + expect(statusOf(text)).toBe('commitable'); + }); + + it('trims lines before classifying (indented `.cladding/` still blocks)', () => { + const text = ['node_modules/', ' .cladding/ ', ''].join('\n'); + expect(statusOf(text)).toBe('blocked'); + }); +}); + +describe('F-b0c2e724 · hasCladdingIgnoreEntry', () => { + it('is true for a real `.cladding/` line', () => { + expect(hasEntry(['dist/', '.cladding/', ''].join('\n'))).toBe(true); + }); + + it('is true for a real bare `.cladding` line', () => { + expect(hasEntry(['dist/', '.cladding', ''].join('\n'))).toBe(true); + }); + + it('is true for a real `.cladding/*` line', () => { + expect(hasEntry(['dist/', '.cladding/*', ''].join('\n'))).toBe(true); + }); + + it('tolerates surrounding whitespace', () => { + expect(hasEntry('\t.cladding/ \n')).toBe(true); + expect(hasEntry(' .cladding \n')).toBe(true); + expect(hasEntry(' .cladding/*\t\n')).toBe(true); + }); + + it('is false for empty text', () => { + expect(hasEntry('')).toBe(false); + }); + + it('is false for unrelated lines', () => { + expect(hasEntry(['node_modules/', 'dist/', '*.log', ''].join('\n'))).toBe(false); + }); + + it('is false when the mention is only inside a comment', () => { + expect(hasEntry(['# .cladding/', '# ignore .cladding later?', ''].join('\n'))).toBe(false); + }); +}); + +describe('F-b0c2e724 · ground truth against git itself', () => { + let repo: string; + + const gitEnv = { + ...process.env, + GIT_CONFIG_GLOBAL: '/dev/null', + GIT_CONFIG_SYSTEM: '/dev/null', + }; + + /** Returns git check-ignore's exit status: 0 = ignored, 1 = not ignored. */ + const checkIgnoreStatus = (relPath: string): number => { + try { + execSync(`git check-ignore -- ${JSON.stringify(relPath)}`, { + cwd: repo, + env: gitEnv, + stdio: 'pipe', + }); + return 0; + } catch (error) { + const status = (error as {status?: number}).status; + return typeof status === 'number' ? status : -1; + } + }; + + beforeAll(() => { + repo = mkdtempSync(join(tmpdir(), 'clad-gitignore-oracle-')); + execSync('git init -q', {cwd: repo, env: gitEnv, stdio: 'pipe'}); + mkdirSync(join(repo, '.cladding'), {recursive: true}); + writeFileSync(join(repo, '.cladding', 'config.yaml'), 'gate: {}\n', 'utf8'); + writeFileSync(join(repo, '.cladding', 'events.log.jsonl'), '{"e":1}\n', 'utf8'); + }); + + afterAll(() => { + if (repo) rmSync(repo, {recursive: true, force: true}); + }); + + it('with CLADDING_IGNORE_BLOCK, git does NOT ignore .cladding/config.yaml', () => { + writeFileSync(join(repo, '.gitignore'), String(CLADDING_IGNORE_BLOCK), 'utf8'); + expect(checkIgnoreStatus('.cladding/config.yaml')).not.toBe(0); + }); + + it('with CLADDING_IGNORE_BLOCK, git DOES ignore .cladding/events.log.jsonl', () => { + writeFileSync(join(repo, '.gitignore'), String(CLADDING_IGNORE_BLOCK), 'utf8'); + expect(checkIgnoreStatus('.cladding/events.log.jsonl')).toBe(0); + }); + + it('with `.cladding/` + `!.cladding/config.yaml`, git STILL ignores config.yaml — the "blocked" verdict is truthful', () => { + writeFileSync(join(repo, '.gitignore'), '.cladding/\n!.cladding/config.yaml\n', 'utf8'); + expect(checkIgnoreStatus('.cladding/config.yaml')).toBe(0); + expect(statusOf('.cladding/\n!.cladding/config.yaml\n')).toBe('blocked'); + }); +}); diff --git a/tests/cli/init.test.ts b/tests/cli/init.test.ts index 21b95410..208b7eef 100644 --- a/tests/cli/init.test.ts +++ b/tests/cli/init.test.ts @@ -62,21 +62,37 @@ describe('runInit', () => { expect(r.language).toBe('typescript'); }); - test('appends .cladding/ to existing .gitignore without losing prior lines', async () => { + test('appends the ignore entry to an existing .gitignore without losing prior lines', async () => { writeFileSync(join(dir, '.gitignore'), 'node_modules/\nbuild/\n'); await runInit({cwd: dir}); const gi = readFileSync(join(dir, '.gitignore'), 'utf8'); expect(gi).toContain('node_modules/'); expect(gi).toContain('build/'); - expect(gi).toContain('.cladding/'); + // The contents form, never the directory form: git cannot re-include a + // file under an excluded directory, so `.cladding/` would make the gate + // config uncommittable and CI would never see the tuned gate. + expect(gi).toContain('.cladding/*'); + expect(gi).toContain('!.cladding/config.yaml'); + expect(gi.split(/\r?\n/)).not.toContain('.cladding/'); + // The re-include must come after the exclusion — a later pattern wins in git. + expect(gi.indexOf('!.cladding/config.yaml')).toBeGreaterThan(gi.indexOf('.cladding/*')); }); - test('does not re-append .cladding/ when already present', async () => { + test('leaves a .gitignore carrying the legacy .cladding/ entry byte-identical', async () => { writeFileSync(join(dir, '.gitignore'), 'node_modules/\n.cladding/\n'); const before = readFileSync(join(dir, '.gitignore'), 'utf8'); - await runInit({cwd: dir}); - const after = readFileSync(join(dir, '.gitignore'), 'utf8'); - expect(after).toBe(before); + const r = await runInit({cwd: dir}); + expect(readFileSync(join(dir, '.gitignore'), 'utf8')).toBe(before); + expect(r.skipped).toContain('.gitignore (cladding entry already present)'); + expect(r.created.some((c) => c.includes('.gitignore'))).toBe(false); + }); + + test('leaves a .gitignore already carrying the new entry byte-identical', async () => { + const before = '# Cladding runtime state\n.cladding/*\n!.cladding/config.yaml\n'; + writeFileSync(join(dir, '.gitignore'), before); + const r = await runInit({cwd: dir}); + expect(readFileSync(join(dir, '.gitignore'), 'utf8')).toBe(before); + expect(r.skipped).toContain('.gitignore (cladding entry already present)'); }); test('creates the index merge attribute while leaving attestation unassigned', async () => { @@ -125,24 +141,24 @@ describe('runInit', () => { expect(yaml).toContain('my-custom-name — Cladding spec'); }); - test('appends .cladding/ to a gitignore that lacks a trailing newline', async () => { + test('appends the ignore entry to a gitignore that lacks a trailing newline', async () => { // Branch: existing.length > 0 && !existing.endsWith('\n') → prepend \n writeFileSync(join(dir, '.gitignore'), 'node_modules/'); await runInit({cwd: dir}); const gi = readFileSync(join(dir, '.gitignore'), 'utf8'); // The original line stays intact and the new entry lands on its own line expect(gi.startsWith('node_modules/')).toBe(true); - expect(gi).toContain('.cladding/'); - // No "node_modules/.cladding/" concatenation - expect(gi).not.toContain('node_modules/.cladding/'); + expect(gi.split(/\r?\n/)).toContain('.cladding/*'); + // No "node_modules/.cladding/*" concatenation + expect(gi).not.toContain('node_modules/.cladding'); }); - test('creates .gitignore from scratch when none exists', async () => { + test('creates .gitignore from scratch with runtime state ignored and gate config committable', async () => { // Branch: existing.length === 0 → ensureNewline stays '' const r = await runInit({cwd: dir}); expect(r.created.some((c) => c.includes('.gitignore'))).toBe(true); const gi = readFileSync(join(dir, '.gitignore'), 'utf8'); - expect(gi).toContain('.cladding/'); + expect(gi).toBe('# Cladding runtime state\n.cladding/*\n!.cladding/config.yaml\n'); }); // v0.3.42 (F-bd07d7) — greenfield seeds. When the auto-scan threshold From abc2c0c30172339fab825d736ed7412be8ffc9b3 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 15:19:30 +0900 Subject: [PATCH 4/6] docs(changelog): record the language-agnostic core under [Unreleased] Co-Authored-By: Claude Opus 5 --- CHANGELOG.md | 11 +++++++++++ spec/attestation.yaml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 660e4c8e..f0d0f691 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,17 @@ 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] + +### Changed + +- **The language check now judges the sources on disk, not the build manifest.** The manifest chain reads build orchestration, so a C++ SDK driven by Gradle or a Rust core shipped through npm was mislabelled by construction — measured across realistic repo shapes, the old comparison blocked 12 of 19 normal projects under `--strict`, including labels cladding's own onboarding had just written. `TECH_STACK_MISMATCH` now reads the observed source distribution from one shared vocabulary: a language it does not know, or a tree with under five classified files, produces silence instead of a false alarm; a declared language absent from the sources still warns with the evidence in the message; a declared language present but under 10% is disclosed at info and never blocks. Gate-command selection still uses the manifest chain — "what do we run" and "what is this project" are different questions, and only the second one moved. +- **The module-honesty scan now derives its universe from evidence.** `UNMAPPED_ARTIFACT` picked one file extension from a six-language table; declaring cpp, java, or csharp fell through to `*.ts`, scanned nothing, and passed vacuously on exactly the projects the check exists for. The scan now unites the extensions observed in the tree with the extensions of modules the spec claims under its layer roots — so an unknown language enters the universe the moment a feature claims a file in it — and infers scan roots from the claimed paths themselves (the Kotlin `src/main/kotlin` layout now comes out of inference, not a table). A root must carry at least a quarter of the layer-claimed modules, which keeps directories that merely reuse a layer name from flooding the scan. + +### Fixed + +- **The gate config can finally be committed.** `clad init` ignored `.cladding/` with the directory form, and git never re-includes under an excluded directory — so `.cladding/config.yaml`, the file that carries every documented gate override, was impossible to commit: fresh clones and CI silently ran a different gate than the author tuned. New projects now get `.cladding/*` plus `!.cladding/config.yaml`. Existing projects are never rewritten; `clad doctor` reports a blocked gate config in text and JSON instead, the same read-only posture as the unpinned-CI report. + ## [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/spec/attestation.yaml b/spec/attestation.yaml index f2e4c70b..95ad8df0 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: d311656aff3813ca - CHANGELOG.md: 78288e943090a029 + CHANGELOG.md: b15c6185d8326b9b CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 README.html: f6403bfe696dad0a From e4ab9a367b9750f853486c406a7c5c78b1f50683 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 15:42:13 +0900 Subject: [PATCH 5/6] fix(detectors): declared layer globs drive the scan, and an empty scan says so MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit External E2E defect D1: the universe derivation matched layer NAMES as path segments, so a layer named anything but a literal directory — measured with 'native' declaring modules: ["core/src/main/cpp/**"] — produced an empty universe and a silent pass, while the identical spec named 'core' found 21 files. The schema has carried per-layer modules globs all along; the detector ignored a declared surface. A layer that declares globs now gets its universe from them (times the evidenced extensions), bypassing name inference; bare layers keep the existing derivation byte-for-byte, and root-dominance math is untouched. When the active full scan matches nothing at all, one info finding names the layers and roots it searched instead of reading as a clean pass — causal control: HEAD's detector printed zero findings on both fixtures. Also records the external E2E's remaining findings as backlog rows B12-B15 (legacy fallback shape, init language seeding, per-detector language resolution, post-init scaffold probe), and reconciles F-a04cd9's "advisory, not consumed" prose with the new consumer. Verified: oracle grown 9→14 blind cases (5 authored against the amended contract before the implementation landed, then passing untouched), 34 unit tests, full suite 2953/2953, external E2E 7/7 PASS at c41ba2e. F-87bb7ed3 (amended) · clad done under a GREEN strict pre-push gate Co-Authored-By: Claude Opus 5 --- README.html | 4 +- README.ja.md | 4 +- README.ko.html | 4 +- README.ko.md | 4 +- README.md | 4 +- README.zh.md | 4 +- docs/refinement-backlog.md | 5 + plugins/claude-code/dist/clad.js | 550 +++++++++--------- spec/attestation.yaml | 20 +- spec/features/ac-hash-ids-a04cd9.yaml | 11 +- ...elf-describing-scan-universe-87bb7ed3.yaml | 21 + src/spec/types.ts | 23 +- src/stages/detectors/unmapped-artifact.ts | 248 +++++++- tests/stages/unmapped-artifact.test.ts | 217 ++++++- .../stages/unmapped-universe-evidence.test.ts | 177 ++++++ 15 files changed, 950 insertions(+), 346 deletions(-) diff --git a/README.html b/README.html index 4ec015c9..d41efefd 100644 --- a/README.html +++ b/README.html @@ -235,7 +235,7 @@

cladding

ironclad spec - tests + tests detectors license

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

Status

tests
-
2936/2936
+
2953/2953
all pass
diff --git a/README.ja.md b/README.ja.md index 3564caec..928dcd6d 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) | 2936 / 2936 | 15 段階 · 41 detectors | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自己申告](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2953 / 2953 | 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 e192ab95..16574601 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
-
2936/2936
+
2953/2953
all pass
diff --git a/README.ko.md b/README.ko.md index 68a9480d..ead5a59a 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) | 2936 / 2936 · 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) | 2953 / 2953 · 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 9d567b45..e5b98037 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) | 2936 / 2936 | 15 stages · 41 detectors | 277 (273 done) | +| v0.9.4 (2026-08) | L4 · [self-declared](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2953 / 2953 | 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 107bdfea..fd795961 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) | 2936 / 2936 | 15 阶段 · 41 检测器 | 277(273 done) | +| v0.9.4(2026-08) | L4 · [自我声明](https://github.com/qwerfunch/ironclad/blob/main/GOVERNANCE.md) | 2953 / 2953 | 15 阶段 · 41 检测器 | 277(273 done) | 253 个测试文件 · 6 项 capability · 覆盖率下降由 COVERAGE_DROP 检测器拦下 diff --git a/docs/refinement-backlog.md b/docs/refinement-backlog.md index fd21bd58..258dbfb7 100644 --- a/docs/refinement-backlog.md +++ b/docs/refinement-backlog.md @@ -15,6 +15,11 @@ Survivors of the 2026-07-03 whole-repo audit (baseline: `clad check --strict` 40 | B10 | spec-conformance stage npx cold-boot | stage_2.3 boots a third vitest via `npx` (spec-conformance.ts:75). Dormant on this repo (stage skips without oracle tests); only matters for adopters with oracle policies. Optimize the spawn (direct bin resolution) when it first shows up in an adopter profile. | S/S/L | | B11 | Complete the 0.6.0 verb-rename residue (refine→clarify, drive→run, panel→status) | Surfaced by the alias removal (F-d25041ac): provenance banners still say `clad init / clad refine` (src/cli/init.ts, scan/*, spec/new.ts, clarify.ts), init.ts:415/422/428 user-facing remediation messages recommend the removed verb, detector messages in project-context-drift/spec-conformance/fixture-reference name it, and the banner strings are EXACT-MATCH test-pinned (tests/scenarios/ab/_drift-injection.ts:64, ab-extended/_curator.ts:1038/1054/1087) — a coherent ~15-src + ~8-fixture migration, deliberately not smuggled into the 2-module alias-removal feature. Highest-severity slice — the init.ts remediation messages — was extracted and fixed pre-release (F-fe0f7a96); remaining scope = banners + fixtures + 3 stale internal comments (init.ts:390, scan/intent-onboarding.ts:696, scan/onboarding-state.ts:7). | M/M/M | +| B12 | Legacy narrow fallback is cladding-shaped | Below the 8-feature scale gate, UNMAPPED_ARTIFACT falls back to the literals `src/stages/**/*.ts` + `src/spec/**/*.ts` — cladding's own layout. In adopter repos it matches nothing (zero module honesty for the first seven features) and in a TS adopter that happens to have `src/stages/` it scans the WRONG thing. Measured in the 2026-08-26 external E2E (D2): 7 features → 0 findings, 8 → 18 on the same tree. Candidate: derive a minimal evidence universe below the gate too, or make the fallback empty + info. Needs its own review — the scale gate guards a real false-RED class (day-1 adoption). | M/S/M | +| B13 | Init seeds a language nothing on disk supports | `clad init` on a zig-only tree seeds `language: typescript` (greenfield default) while the evidence path resolves `unknown` — the spec then carries a claim no detector will ever contradict (TECH_STACK_MISMATCH is correctly silent on sub-floor/unknown evidence). External E2E 2026-08-26 (D4). Candidate: seed the observed dominant when available, else omit/`unknown`. Schema requires `language`, so `unknown` is the honest floor. | S/S/L | +| B14 | Per-detector language resolution disagrees with evidence | ARCHITECTURE_FROM_SPEC (via resolveLanguageConfig) resolves 'java' on a cpp-spec, cpp-majority tree because unknown spec labels fall through to the manifest chain (External E2E 2026-08-26, D5). This is the Phase-3 seam already planned: derive the 4 LanguageConfig consumers (COVERAGE_DROP, STALE_TESTS, CONVENTION_DRIFT, ARCHITECTURE_FROM_SPEC) from evidence instead of TS/manifest fallback. Own feature cycle + own corpus. | M/M/M | +| B15 | Post-init scaffold check contradicts init's own output | Right after `clad init` printed `created spec/scenarios/README.md`, the next check reports `spec/scenarios is absent — scaffold incomplete` (info) though the directory exists (External E2E 2026-08-26, D3). Pre-existing; likely a path/existence probe mismatch. | S/S/L | + ## Reviewed and REJECTED — do not re-open without new evidence - **Merge unit (2.1) + coverage (2.2) into one vitest run**: conformance/fixtures.yaml:82-85 pins "tests green + coverage below floor" as distinct stage outcomes; `mvn jacoco:report` runs no tests on JVM; gate-golden-matrix.test.ts pins stage independence. The double suite run is the deliberate price of separable verdicts. diff --git a/plugins/claude-code/dist/clad.js b/plugins/claude-code/dist/clad.js index 44c83243..43034680 100755 --- a/plugins/claude-code/dist/clad.js +++ b/plugins/claude-code/dist/clad.js @@ -4,102 +4,102 @@ 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 jfe=Object.create;var LA=Object.defineProperty;var Mfe=Object.getOwnPropertyDescriptor;var Ffe=Object.getOwnPropertyNames;var Lfe=Object.getPrototypeOf,zfe=Object.prototype.hasOwnProperty;var Ze=(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)LA(t,r,{get:e[r],enumerable:!0})},Ufe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ffe(e))!zfe.call(t,i)&&i!==r&&LA(t,i,{get:()=>e[i],enumerable:!(n=Mfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?jfe(Lfe(t)):{},Ufe(e||!t||!t.__esModule?LA(r,"default",{value:t,enumerable:!0}):r,t));var ff=v(UA=>{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}},zA=class extends Ty{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};UA.CommanderError=Ty;UA.InvalidArgumentError=zA});var Oy=v(HA=>{var{InvalidArgumentError:qfe}=ff(),qA=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 qfe(`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 Hfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}HA.Argument=qA;HA.humanReadableArgName=Hfe});var ZA=v(GA=>{var{humanReadableArgName:Bfe}=Oy(),BA=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=>Bfe(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 jfe=Object.create;var zA=Object.defineProperty;var Mfe=Object.getOwnPropertyDescriptor;var Ffe=Object.getOwnPropertyNames;var Lfe=Object.getPrototypeOf,zfe=Object.prototype.hasOwnProperty;var Ze=(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)zA(t,r,{get:e[r],enumerable:!0})},Ufe=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ffe(e))!zfe.call(t,i)&&i!==r&&zA(t,i,{get:()=>e[i],enumerable:!(n=Mfe(e,i))||n.enumerable});return t};var wt=(t,e,r)=>(r=t!=null?jfe(Lfe(t)):{},Ufe(e||!t||!t.__esModule?zA(r,"default",{value:t,enumerable:!0}):r,t));var ff=v(qA=>{var Oy=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}},UA=class extends Oy{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};qA.CommanderError=Oy;qA.InvalidArgumentError=UA});var Ty=v(BA=>{var{InvalidArgumentError:qfe}=ff(),HA=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 qfe(`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 Hfe(t){let e=t.name()+(t.variadic===!0?"...":"");return t.required?"<"+e+">":"["+e+"]"}BA.Argument=HA;BA.humanReadableArgName=Hfe});var VA=v(ZA=>{var{humanReadableArgName:Bfe}=Ty(),GA=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=>Bfe(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 C4(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 C4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}GA.Help=BA;GA.stripColor=C4});var JA=v(KA=>{var{InvalidArgumentError:Gfe}=ff(),VA=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=Zfe(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 Gfe(`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?D4(this.name().replace(/^no-/,"")):D4(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}},WA=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 D4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Zfe(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 C4(t){let e=/\x1b\[\d*(;\d*)*m/g;return t.replace(e,"")}ZA.Help=GA;ZA.stripColor=C4});var YA=v(JA=>{var{InvalidArgumentError:Gfe}=ff(),WA=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=Zfe(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 Gfe(`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?D4(this.name().replace(/^no-/,"")):D4(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}},KA=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 D4(t){return t.split("-").reduce((e,r)=>e+r[0].toUpperCase()+r.slice(1))}function Zfe(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} - too many short flags`):i.test(s)?new Error(`${a} - too many long flags`):new Error(`${a} -- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}KA.Option=VA;KA.DualOptions=WA});var j4=v(N4=>{function Vfe(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 Wfe(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=Vfe(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?` +- unrecognised flag format`)}if(e===void 0&&r===void 0)throw new Error(`option creation failed due to no flags found in '${t}'.`);return{shortFlag:e,longFlag:r}}JA.Option=WA;JA.DualOptions=KA});var j4=v(N4=>{function Vfe(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 Wfe(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=Vfe(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]}?)`:""}N4.suggestSimilar=Wfe});var z4=v(tT=>{var Kfe=Ze("node:events").EventEmitter,YA=Ze("node:child_process"),mo=Ze("node:path"),Ry=Ze("node:fs"),He=Ze("node:process"),{Argument:Jfe,humanReadableArgName:Yfe}=Oy(),{CommanderError:XA}=ff(),{Help:Xfe,stripColor:Qfe}=ZA(),{Option:M4,DualOptions:epe}=JA(),{suggestSimilar:F4}=j4(),QA=class t extends Kfe{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:()=>eT()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>eT()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Qfe(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 Xfe,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]}?)`:""}N4.suggestSimilar=Wfe});var z4=v(rO=>{var Kfe=Ze("node:events").EventEmitter,XA=Ze("node:child_process"),mo=Ze("node:path"),Ry=Ze("node:fs"),He=Ze("node:process"),{Argument:Jfe,humanReadableArgName:Yfe}=Ty(),{CommanderError:QA}=ff(),{Help:Xfe,stripColor:Qfe}=VA(),{Option:M4,DualOptions:epe}=YA(),{suggestSimilar:F4}=j4(),eO=class t extends Kfe{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:()=>tO()??(He.stdout.isTTY&&He.stdout.hasColors?.()),getErrHasColors:()=>tO()??(He.stderr.isTTY&&He.stderr.hasColors?.()),stripColor:r=>Qfe(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 Xfe,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 XA(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 M4(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}' +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 QA(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 M4(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 M4)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(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(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=L4(He.execArgv).concat(r),c=YA.spawn(He.argv[0],r,{stdio:"inherit"})):c=YA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=L4(He.execArgv).concat(r),c=YA.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 XA(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 XA(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=L4(He.execArgv).concat(r),c=XA.spawn(He.argv[0],r,{stdio:"inherit"})):c=XA.spawn(s,r,{stdio:"inherit"}):(this._checkForMissingExecutable(s,a,e._name),r.unshift(s),r=L4(He.execArgv).concat(r),c=XA.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 QA(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 QA(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 epe(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=F4(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=F4(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=>Yfe(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 L4(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 eT(){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}tT.Command=QA;tT.useColor=eT});var B4=v(On=>{var{Argument:U4}=Oy(),{Command:rT}=z4(),{CommanderError:tpe,InvalidArgumentError:q4}=ff(),{Help:rpe}=ZA(),{Option:H4}=JA();On.program=new rT;On.createCommand=t=>new rT(t);On.createOption=(t,e)=>new H4(t,e);On.createArgument=(t,e)=>new U4(t,e);On.Command=rT;On.Option=H4;On.Argument=U4;On.Help=rpe;On.CommanderError=tpe;On.InvalidArgumentError=q4;On.InvalidOptionArgumentError=q4});var De=v(er=>{"use strict";var iT=Symbol.for("yaml.alias"),W4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),K4=Symbol.for("yaml.pair"),oT=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),cpe=t=>!!t&&typeof t=="object"&&t[ho]===iT,lpe=t=>!!t&&typeof t=="object"&&t[ho]===W4,upe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,dpe=t=>!!t&&typeof t=="object"&&t[ho]===K4,J4=t=>!!t&&typeof t=="object"&&t[ho]===oT,fpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function Y4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ppe(t){if(t&&typeof t=="object")switch(t[ho]){case iT:case Iy:case oT:case Py:return!0}return!1}var mpe=t=>(J4(t)||Y4(t))&&!!t.anchor;er.ALIAS=iT;er.DOC=W4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=K4;er.SCALAR=oT;er.SEQ=Py;er.hasAnchor=mpe;er.isAlias=cpe;er.isCollection=Y4;er.isDocument=lpe;er.isMap=upe;er.isNode=ppe;er.isPair=dpe;er.isScalar=J4;er.isSeq=fpe});var pf=v(sT=>{"use strict";var Ut=De(),jr=Symbol("break visit"),X4=Symbol("skip children"),Ti=Symbol("remove node");function Cy(t,e){let r=Q4(e);Ut.isDocument(t)?il(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):il(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=X4;Cy.REMOVE=Ti;function il(t,e,r,n){let i=eH(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return tH(t,n,i),il(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 rH=De(),hpe=pf(),gpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ype=t=>t.replace(/[!,[\]{}]/g,e=>gpe[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+ype(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&&rH.isNode(e.contents)){let o={};hpe.visit(e.contents,(s,a)=>{rH.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:"};nH.Directives=mf});var Ny=v(hf=>{"use strict";var iH=De(),_pe=pf();function bpe(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 oH(t){let e=new Set;return _pe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function sH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function vpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=oH(t));let s=sH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(iH.isScalar(s.node)||iH.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=bpe;hf.anchorNames=oH;hf.createNodeAnchors=vpe;hf.findNewAnchor=sH});var cT=v(aH=>{"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 Spe=De();function cH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>cH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Spe.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}lH.toJS=cH});var jy=v(dH=>{"use strict";var wpe=cT(),uH=De(),xpe=Wo(),lT=class{constructor(e){Object.defineProperty(this,uH.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(!uH.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=xpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?wpe.applyReviver(o,{"":a},"",a):a}};dH.NodeBase=lT});var yf=v(fH=>{"use strict";var $pe=Ny(),kpe=pf(),sl=De(),Epe=jy(),Ape=Wo(),uT=class extends Epe.NodeBase{constructor(e){super(sl.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=[],kpe.visit(e,{Node:(o,s)=>{(sl.isAlias(s)||sl.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||(Ape.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($pe.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(sl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(sl.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(sl.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}fH.Alias=uT});var Dt=v(dT=>{"use strict";var Tpe=De(),Ope=jy(),Rpe=Wo(),Ipe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Ope.NodeBase{constructor(e){super(Tpe.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Rpe.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";dT.Scalar=Ko;dT.isScalarValue=Ipe});var _f=v(mH=>{"use strict";var Ppe=yf(),ha=De(),pH=Dt(),Cpe="tag:yaml.org,2002:";function Dpe(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 Npe(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 Ppe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Cpe+e.slice(2));let l=Dpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new pH.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 pH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}mH.createNode=Npe});var Ly=v(Fy=>{"use strict";var jpe=_f(),Oi=De(),Mpe=jy();function fT(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 jpe.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 hH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,pT=class extends Mpe.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(hH(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,fT(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,fT(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=pT;Fy.collectionFromPath=fT;Fy.isEmptyPath=hH});var bf=v(zy=>{"use strict";var Fpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function mT(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Lpe=(t,e,r)=>t.endsWith(` -`)?mT(r,e):r.includes(` +`)}),this}_outputHelpIfRequested(e){let r=this._getHelpOption();r&&e.find(i=>r.is(i))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function L4(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 tO(){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}rO.Command=eO;rO.useColor=tO});var B4=v(Tn=>{var{Argument:U4}=Ty(),{Command:nO}=z4(),{CommanderError:tpe,InvalidArgumentError:q4}=ff(),{Help:rpe}=VA(),{Option:H4}=YA();Tn.program=new nO;Tn.createCommand=t=>new nO(t);Tn.createOption=(t,e)=>new H4(t,e);Tn.createArgument=(t,e)=>new U4(t,e);Tn.Command=nO;Tn.Option=H4;Tn.Argument=U4;Tn.Help=rpe;Tn.CommanderError=tpe;Tn.InvalidArgumentError=q4;Tn.InvalidOptionArgumentError=q4});var De=v(er=>{"use strict";var oO=Symbol.for("yaml.alias"),W4=Symbol.for("yaml.document"),Iy=Symbol.for("yaml.map"),K4=Symbol.for("yaml.pair"),sO=Symbol.for("yaml.scalar"),Py=Symbol.for("yaml.seq"),ho=Symbol.for("yaml.node.type"),cpe=t=>!!t&&typeof t=="object"&&t[ho]===oO,lpe=t=>!!t&&typeof t=="object"&&t[ho]===W4,upe=t=>!!t&&typeof t=="object"&&t[ho]===Iy,dpe=t=>!!t&&typeof t=="object"&&t[ho]===K4,J4=t=>!!t&&typeof t=="object"&&t[ho]===sO,fpe=t=>!!t&&typeof t=="object"&&t[ho]===Py;function Y4(t){if(t&&typeof t=="object")switch(t[ho]){case Iy:case Py:return!0}return!1}function ppe(t){if(t&&typeof t=="object")switch(t[ho]){case oO:case Iy:case sO:case Py:return!0}return!1}var mpe=t=>(J4(t)||Y4(t))&&!!t.anchor;er.ALIAS=oO;er.DOC=W4;er.MAP=Iy;er.NODE_TYPE=ho;er.PAIR=K4;er.SCALAR=sO;er.SEQ=Py;er.hasAnchor=mpe;er.isAlias=cpe;er.isCollection=Y4;er.isDocument=lpe;er.isMap=upe;er.isNode=ppe;er.isPair=dpe;er.isScalar=J4;er.isSeq=fpe});var pf=v(aO=>{"use strict";var Ut=De(),jr=Symbol("break visit"),X4=Symbol("skip children"),Oi=Symbol("remove node");function Cy(t,e){let r=Q4(e);Ut.isDocument(t)?il(null,t.contents,r,Object.freeze([t]))===Oi&&(t.contents=null):il(null,t,r,Object.freeze([]))}Cy.BREAK=jr;Cy.SKIP=X4;Cy.REMOVE=Oi;function il(t,e,r,n){let i=eH(t,e,r,n);if(Ut.isNode(i)||Ut.isPair(i))return tH(t,n,i),il(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 rH=De(),hpe=pf(),gpe={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},ype=t=>t.replace(/[!,[\]{}]/g,e=>gpe[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+ype(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&&rH.isNode(e.contents)){let o={};hpe.visit(e.contents,(s,a)=>{rH.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:"};nH.Directives=mf});var Ny=v(hf=>{"use strict";var iH=De(),_pe=pf();function bpe(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 oH(t){let e=new Set;return _pe.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function sH(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function vpe(t,e){let r=[],n=new Map,i=null;return{onAnchor:o=>{r.push(o),i??(i=oH(t));let s=sH(e,i);return i.add(s),s},setAnchors:()=>{for(let o of r){let s=n.get(o);if(typeof s=="object"&&s.anchor&&(iH.isScalar(s.node)||iH.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=bpe;hf.anchorNames=oH;hf.createNodeAnchors=vpe;hf.findNewAnchor=sH});var lO=v(aH=>{"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 Spe=De();function cH(t,e,r){if(Array.isArray(t))return t.map((n,i)=>cH(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Spe.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}lH.toJS=cH});var jy=v(dH=>{"use strict";var wpe=lO(),uH=De(),xpe=Wo(),uO=class{constructor(e){Object.defineProperty(this,uH.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(!uH.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=xpe.toJS(this,"",s);if(typeof i=="function")for(let{count:c,res:l}of s.anchors.values())i(l,c);return typeof o=="function"?wpe.applyReviver(o,{"":a},"",a):a}};dH.NodeBase=uO});var yf=v(fH=>{"use strict";var $pe=Ny(),kpe=pf(),sl=De(),Epe=jy(),Ape=Wo(),dO=class extends Epe.NodeBase{constructor(e){super(sl.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=[],kpe.visit(e,{Node:(o,s)=>{(sl.isAlias(s)||sl.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||(Ape.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($pe.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(sl.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(sl.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(sl.isPair(e)){let n=My(t,e.key,r),i=My(t,e.value,r);return Math.max(n,i)}return 1}fH.Alias=dO});var Dt=v(fO=>{"use strict";var Ope=De(),Tpe=jy(),Rpe=Wo(),Ipe=t=>!t||typeof t!="function"&&typeof t!="object",Ko=class extends Tpe.NodeBase{constructor(e){super(Ope.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Rpe.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";fO.Scalar=Ko;fO.isScalarValue=Ipe});var _f=v(mH=>{"use strict";var Ppe=yf(),ha=De(),pH=Dt(),Cpe="tag:yaml.org,2002:";function Dpe(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 Npe(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 Ppe.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Cpe+e.slice(2));let l=Dpe(t,e,s.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new pH.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 pH.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}mH.createNode=Npe});var Ly=v(Fy=>{"use strict";var jpe=_f(),Ti=De(),Mpe=jy();function pO(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 jpe.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 hH=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,mO=class extends Mpe.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=>Ti.isNode(n)||Ti.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(hH(e))this.add(r);else{let[n,...i]=e,o=this.get(n,!0);if(Ti.isCollection(o))o.addIn(i,r);else if(o===void 0&&this.schema)this.set(n,pO(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(Ti.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&&Ti.isScalar(o)?o.value:o:Ti.isCollection(o)?o.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!Ti.isPair(r))return!1;let n=r.value;return n==null||e&&Ti.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 Ti.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(Ti.isCollection(o))o.setIn(i,r);else if(o===void 0&&this.schema)this.set(n,pO(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Fy.Collection=mO;Fy.collectionFromPath=pO;Fy.isEmptyPath=hH});var bf=v(zy=>{"use strict";var Fpe=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function hO(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Lpe=(t,e,r)=>t.endsWith(` +`)?hO(r,e):r.includes(` `)?` -`+mT(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=mT;zy.lineComment=Lpe;zy.stringifyComment=Fpe});var yH=v(vf=>{"use strict";var zpe="flow",hT="block",Uy="quoted";function Upe(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===hT&&(h=gH(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===hT&&(h=gH(t,h,e.length)),d=h+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==` +`+hO(r,e):(t.endsWith(" ")?"":" ")+r;zy.indentComment=hO;zy.lineComment=Lpe;zy.stringifyComment=Fpe});var yH=v(vf=>{"use strict";var zpe="flow",gO="block",Uy="quoted";function Upe(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===gO&&(h=gH(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===gO&&(h=gH(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===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=yH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function qpe(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;o{"use strict";var Xn=Dt(),Jo=yH(),Hy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),By=t=>/^(%|---|\.\.\.)/m.test(t);function qpe(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(yT,`$&${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} -${l}${T}`}return r=r.replace(/\n+/g,`$&${l}`),`|${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 O=Jo.foldFlowLines(`${_}${w}${p}`,l,Jo.FOLD_BLOCK,A);if(!R)return`>${x} +${l}${O}`}return r=r.replace(/\n+/g,`$&${l}`),`|${x} ${l}${_}${r}${p}`}function Hpe(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 al(o,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(o))return a||u||!o.includes(` `)?al(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 al(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 al(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,Hy(e,!1))}function Bpe(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?al(s.value,e):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return Sf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return gT(s.value,e);case Xn.Scalar.PLAIN:return Hpe(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}_H.stringifyString=Bpe});var xf=v(_T=>{"use strict";var Gpe=Ny(),Yo=De(),Zpe=bf(),Vpe=wf();function Wpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Zpe.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 Kpe(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&&Gpe.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 Ype(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=Kpe(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)?Vpe.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}_T.createStringifyContext=Wpe;_T.stringify=Ype});var wH=v(SH=>{"use strict";var go=De(),bH=Dt(),vH=xf(),$f=bf();function Xpe({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===bH.Scalar.BLOCK_FOLDED||t.type===bH.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=vH.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} +${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 al(o,e)}return a?d:Jo.foldFlowLines(d,c,Jo.FOLD_FLOW,Hy(e,!1))}function Bpe(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?al(s.value,e):qy(s,e,r,n);case Xn.Scalar.QUOTE_DOUBLE:return Sf(s.value,e);case Xn.Scalar.QUOTE_SINGLE:return yO(s.value,e);case Xn.Scalar.PLAIN:return Hpe(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}_H.stringifyString=Bpe});var xf=v(bO=>{"use strict";var Gpe=Ny(),Yo=De(),Zpe=bf(),Vpe=wf();function Wpe(t,e){let r=Object.assign({blockQuote:!0,commentString:Zpe.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 Kpe(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&&Gpe.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 Ype(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=Kpe(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)?Vpe.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}bO.createStringifyContext=Wpe;bO.stringify=Ype});var wH=v(SH=>{"use strict";var go=De(),bH=Dt(),vH=xf(),$f=bf();function Xpe({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===bH.Scalar.BLOCK_FOLDED||t.type===bH.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=vH.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=vH.stringify(e,r,()=>x=!0,()=>h=!0),R=" ";if(f||b||_){if(R=b?` `:"",_){let A=l(_);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 xH=Ze("process");function Qpe(t,...e){t==="debug"&&console.log(...e)}function eme(t,e){(t==="debug"||t==="warn")&&(typeof xH.emitWarning=="function"?xH.emitWarning(e):console.warn(e))}bT.debug=Qpe;bT.warn=eme});var Ky=v(Wy=>{"use strict";var Vy=De(),$H=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 $H.Scalar(Symbol(Gy)),{addToJSMap:kH}),stringify:()=>Gy},tme=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===$H.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function kH(t,e,r){let n=EH(t,r);if(Vy.isSeq(n))for(let i of n.items)ST(t,e,i);else if(Array.isArray(n))for(let i of n)ST(t,e,i);else ST(t,e,n)}function ST(t,e,r){let n=EH(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 EH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=kH;Wy.isMergeKey=tme;Wy.merge=Zy});var xT=v(OH=>{"use strict";var rme=vT(),AH=Ky(),nme=xf(),TH=De(),wT=Wo();function ime(t,e,{key:r,value:n}){if(TH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(AH.isMergeKey(t,r))AH.addMergeToJSMap(t,e,n);else{let i=wT.toJS(r,"",t);if(e instanceof Map)e.set(i,wT.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ome(r,i,t),s=wT.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 ome(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(TH.isNode(t)&&r?.doc){let n=nme.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)+'..."'),rme.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)}OH.addPairToJSMap=ime});var Xo=v($T=>{"use strict";var RH=_f(),sme=wH(),ame=xT(),Jy=De();function cme(t,e,r){let n=RH.createNode(t,void 0,r),i=RH.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 ame.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?sme.stringifyPair(this,e,r,n):JSON.stringify(this)}};$T.Pair=Yy;$T.createPair=cme});var kT=v(PH=>{"use strict";var ga=De(),IH=xf(),Xy=bf();function lme(t,e,r){return(e.inFlow??t.flow?dme:ume)(t,e,r)}function ume({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;m{"use strict";var xH=Ze("process");function Qpe(t,...e){t==="debug"&&console.log(...e)}function eme(t,e){(t==="debug"||t==="warn")&&(typeof xH.emitWarning=="function"?xH.emitWarning(e):console.warn(e))}vO.debug=Qpe;vO.warn=eme});var Ky=v(Wy=>{"use strict";var Vy=De(),$H=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 $H.Scalar(Symbol(Gy)),{addToJSMap:kH}),stringify:()=>Gy},tme=(t,e)=>(Zy.identify(e)||Vy.isScalar(e)&&(!e.type||e.type===$H.Scalar.PLAIN)&&Zy.identify(e.value))&&t?.doc.schema.tags.some(r=>r.tag===Zy.tag&&r.default);function kH(t,e,r){let n=EH(t,r);if(Vy.isSeq(n))for(let i of n.items)wO(t,e,i);else if(Array.isArray(n))for(let i of n)wO(t,e,i);else wO(t,e,n)}function wO(t,e,r){let n=EH(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 EH(t,e){return t&&Vy.isAlias(e)?e.resolve(t.doc,t):e}Wy.addMergeToJSMap=kH;Wy.isMergeKey=tme;Wy.merge=Zy});var $O=v(TH=>{"use strict";var rme=SO(),AH=Ky(),nme=xf(),OH=De(),xO=Wo();function ime(t,e,{key:r,value:n}){if(OH.isNode(r)&&r.addToJSMap)r.addToJSMap(t,e,n);else if(AH.isMergeKey(t,r))AH.addMergeToJSMap(t,e,n);else{let i=xO.toJS(r,"",t);if(e instanceof Map)e.set(i,xO.toJS(n,i,t));else if(e instanceof Set)e.add(i);else{let o=ome(r,i,t),s=xO.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 ome(t,e,r){if(e===null)return"";if(typeof e!="object")return String(e);if(OH.isNode(t)&&r?.doc){let n=nme.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)+'..."'),rme.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)}TH.addPairToJSMap=ime});var Xo=v(kO=>{"use strict";var RH=_f(),sme=wH(),ame=$O(),Jy=De();function cme(t,e,r){let n=RH.createNode(t,void 0,r),i=RH.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 ame.addPairToJSMap(r,n,this)}toString(e,r,n){return e?.doc?sme.stringifyPair(this,e,r,n):JSON.stringify(this)}};kO.Pair=Yy;kO.createPair=cme});var EO=v(PH=>{"use strict";var ga=De(),IH=xf(),Xy=bf();function lme(t,e,r){return(e.inFlow??t.flow?dme:ume)(t,e,r)}function ume({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+=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 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())}}PH.stringifyCollection=lme});var es=v(AT=>{"use strict";var fme=kT(),pme=xT(),mme=Ly(),Qo=De(),e_=Xo(),hme=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 ET=class extends mme.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)&&hme.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)pme.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})),fme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};AT.YAMLMap=ET;AT.findPair=kf});var cl=v(DH=>{"use strict";var gme=De(),CH=es(),yme={collection:"map",default:!0,nodeClass:CH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return gme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>CH.YAMLMap.from(t,e,r)};DH.map=yme});var ts=v(NH=>{"use strict";var _me=_f(),bme=kT(),vme=Ly(),r_=De(),Sme=Dt(),wme=Wo(),TT=class extends vme.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}NH.YAMLSeq=TT});var ll=v(MH=>{"use strict";var xme=De(),jH=ts(),$me={collection:"seq",default:!0,nodeClass:jH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return xme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>jH.YAMLSeq.from(t,e,r)};MH.seq=$me});var Ef=v(FH=>{"use strict";var kme=wf(),Eme={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),kme.stringifyString(t,e,r,n)}};FH.string=Eme});var n_=v(UH=>{"use strict";var LH=Dt(),zH={identify:t=>t==null,createNode:()=>new LH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new LH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&zH.test.test(t)?t:e.options.nullStr};UH.nullTag=zH});var OT=v(HH=>{"use strict";var Ame=Dt(),qH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ame.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&qH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};HH.boolTag=qH});var ul=v(BH=>{"use strict";function Tme({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}BH.stringifyNumber=Tme});var IT=v(i_=>{"use strict";var Ome=Dt(),RT=ul(),Rme={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:RT.stringifyNumber},Ime={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():RT.stringifyNumber(t)}},Pme={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 Ome.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:RT.stringifyNumber};i_.float=Pme;i_.floatExp=Ime;i_.floatNaN=Rme});var CT=v(s_=>{"use strict";var GH=ul(),o_=t=>typeof t=="bigint"||Number.isInteger(t),PT=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function ZH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):GH.stringifyNumber(t)}var Cme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>PT(t,2,8,r),stringify:t=>ZH(t,8,"0o")},Dme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>PT(t,0,10,r),stringify:GH.stringifyNumber},Nme={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)=>PT(t,2,16,r),stringify:t=>ZH(t,16,"0x")};s_.int=Dme;s_.intHex=Nme;s_.intOct=Cme});var WH=v(VH=>{"use strict";var jme=cl(),Mme=n_(),Fme=ll(),Lme=Ef(),zme=OT(),DT=IT(),NT=CT(),Ume=[jme.map,Fme.seq,Lme.string,Mme.nullTag,zme.boolTag,NT.intOct,NT.int,NT.intHex,DT.floatNaN,DT.floatExp,DT.float];VH.schema=Ume});var YH=v(JH=>{"use strict";var qme=Dt(),Hme=cl(),Bme=ll();function KH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Gme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new qme.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:KH,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})=>KH(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_}],Zme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vme=[Hme.map,Bme.seq].concat(Gme,Zme);JH.schema=Vme});var MT=v(XH=>{"use strict";var Af=Ze("buffer"),jT=Dt(),Wme=wf(),Kme={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(),FT=Xo(),Jme=Dt(),Yme=ts();function QH(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 FT.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())}}PH.stringifyCollection=lme});var es=v(OO=>{"use strict";var fme=EO(),pme=$O(),mme=Ly(),Qo=De(),e_=Xo(),hme=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 AO=class extends mme.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)&&hme.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)pme.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})),fme.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:r})}};OO.YAMLMap=AO;OO.findPair=kf});var cl=v(DH=>{"use strict";var gme=De(),CH=es(),yme={collection:"map",default:!0,nodeClass:CH.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(t,e){return gme.isMap(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,r)=>CH.YAMLMap.from(t,e,r)};DH.map=yme});var ts=v(NH=>{"use strict";var _me=_f(),bme=EO(),vme=Ly(),r_=De(),Sme=Dt(),wme=Wo(),TO=class extends vme.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}NH.YAMLSeq=TO});var ll=v(MH=>{"use strict";var xme=De(),jH=ts(),$me={collection:"seq",default:!0,nodeClass:jH.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(t,e){return xme.isSeq(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,r)=>jH.YAMLSeq.from(t,e,r)};MH.seq=$me});var Ef=v(FH=>{"use strict";var kme=wf(),Eme={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),kme.stringifyString(t,e,r,n)}};FH.string=Eme});var n_=v(UH=>{"use strict";var LH=Dt(),zH={identify:t=>t==null,createNode:()=>new LH.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new LH.Scalar(null),stringify:({source:t},e)=>typeof t=="string"&&zH.test.test(t)?t:e.options.nullStr};UH.nullTag=zH});var RO=v(HH=>{"use strict";var Ame=Dt(),qH={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Ame.Scalar(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},r){if(t&&qH.test.test(t)){let n=t[0]==="t"||t[0]==="T";if(e===n)return t}return e?r.options.trueStr:r.options.falseStr}};HH.boolTag=qH});var ul=v(BH=>{"use strict";function Ome({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}BH.stringifyNumber=Ome});var PO=v(i_=>{"use strict";var Tme=Dt(),IO=ul(),Rme={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:IO.stringifyNumber},Ime={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():IO.stringifyNumber(t)}},Pme={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 Tme.Scalar(parseFloat(t)),r=t.indexOf(".");return r!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-r-1),e},stringify:IO.stringifyNumber};i_.float=Pme;i_.floatExp=Ime;i_.floatNaN=Rme});var DO=v(s_=>{"use strict";var GH=ul(),o_=t=>typeof t=="bigint"||Number.isInteger(t),CO=(t,e,r,{intAsBigInt:n})=>n?BigInt(t):parseInt(t.substring(e),r);function ZH(t,e,r){let{value:n}=t;return o_(n)&&n>=0?r+n.toString(e):GH.stringifyNumber(t)}var Cme={identify:t=>o_(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,r)=>CO(t,2,8,r),stringify:t=>ZH(t,8,"0o")},Dme={identify:o_,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,r)=>CO(t,0,10,r),stringify:GH.stringifyNumber},Nme={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)=>CO(t,2,16,r),stringify:t=>ZH(t,16,"0x")};s_.int=Dme;s_.intHex=Nme;s_.intOct=Cme});var WH=v(VH=>{"use strict";var jme=cl(),Mme=n_(),Fme=ll(),Lme=Ef(),zme=RO(),NO=PO(),jO=DO(),Ume=[jme.map,Fme.seq,Lme.string,Mme.nullTag,zme.boolTag,jO.intOct,jO.int,jO.intHex,NO.floatNaN,NO.floatExp,NO.float];VH.schema=Ume});var YH=v(JH=>{"use strict";var qme=Dt(),Hme=cl(),Bme=ll();function KH(t){return typeof t=="bigint"||Number.isInteger(t)}var a_=({value:t})=>JSON.stringify(t),Gme=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:a_},{identify:t=>t==null,createNode:()=>new qme.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:KH,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})=>KH(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_}],Zme={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Vme=[Hme.map,Bme.seq].concat(Gme,Zme);JH.schema=Vme});var FO=v(XH=>{"use strict";var Af=Ze("buffer"),MO=Dt(),Wme=wf(),Kme={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(),LO=Xo(),Jme=Dt(),Yme=ts();function QH(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 LO.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]=c_.isPair(n)?n:new FT.Pair(n)}}else e("Expected a sequence for this tag");return t}function e6(t,e,r){let{replacer:n}=r,i=new Yme.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(FT.createPair(a,c,r))}return i}var Xme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QH,createNode:e6};l_.createPairs=e6;l_.pairs=Xme;l_.resolvePairs=QH});var UT=v(zT=>{"use strict";var t6=De(),LT=Wo(),Tf=es(),Qme=ts(),r6=u_(),ya=class t extends Qme.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(t6.isPair(i)?(o=LT.toJS(i.key,"",r),s=LT.toJS(i.value,o,r)):o=LT.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=r6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var ehe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=r6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)t6.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)};zT.YAMLOMap=ya;zT.omap=ehe});var a6=v(qT=>{"use strict";var n6=Dt();function i6({value:t,source:e},r){return e&&(t?o6:s6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var o6={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 n6.Scalar(!0),stringify:i6},s6={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 n6.Scalar(!1),stringify:i6};qT.falseTag=s6;qT.trueTag=o6});var c6=v(d_=>{"use strict";var the=Dt(),HT=ul(),rhe={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:HT.stringifyNumber},nhe={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():HT.stringifyNumber(t)}},ihe={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 the.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:HT.stringifyNumber};d_.float=ihe;d_.floatExp=nhe;d_.floatNaN=rhe});var u6=v(Rf=>{"use strict";var l6=ul(),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 BT(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 l6.stringifyNumber(t)}var ohe={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=>BT(t,2,"0b")},she={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=>BT(t,8,"0")},ahe={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:l6.stringifyNumber},che={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=>BT(t,16,"0x")};Rf.int=ahe;Rf.intBin=ohe;Rf.intHex=che;Rf.intOct=she});var ZT=v(GT=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var lhe={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(h_.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}};GT.YAMLSet=_a;GT.set=lhe});var WT=v(g_=>{"use strict";var uhe=ul();function VT(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 d6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return uhe.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 dhe={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})=>VT(t,r),stringify:d6},fhe={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=>VT(t,!1),stringify:d6},f6={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(f6.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=VT(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=fhe;g_.intTime=dhe;g_.timestamp=f6});var h6=v(m6=>{"use strict";var phe=cl(),mhe=n_(),hhe=ll(),ghe=Ef(),yhe=MT(),p6=a6(),KT=c6(),y_=u6(),_he=Ky(),bhe=UT(),vhe=u_(),She=ZT(),JT=WT(),whe=[phe.map,hhe.seq,ghe.string,mhe.nullTag,p6.trueTag,p6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,KT.floatNaN,KT.floatExp,KT.float,yhe.binary,_he.merge,bhe.omap,vhe.pairs,She.set,JT.intTime,JT.floatTime,JT.timestamp];m6.schema=whe});var k6=v(QT=>{"use strict";var b6=cl(),xhe=n_(),v6=ll(),$he=Ef(),khe=OT(),YT=IT(),XT=CT(),Ehe=WH(),Ahe=YH(),S6=MT(),If=Ky(),w6=UT(),x6=u_(),g6=h6(),$6=ZT(),__=WT(),y6=new Map([["core",Ehe.schema],["failsafe",[b6.map,v6.seq,$he.string]],["json",Ahe.schema],["yaml11",g6.schema],["yaml-1.1",g6.schema]]),_6={binary:S6.binary,bool:khe.boolTag,float:YT.float,floatExp:YT.floatExp,floatNaN:YT.floatNaN,floatTime:__.floatTime,int:XT.int,intHex:XT.intHex,intOct:XT.intOct,intTime:__.intTime,map:b6.map,merge:If.merge,null:xhe.nullTag,omap:w6.omap,pairs:x6.pairs,seq:v6.seq,set:$6.set,timestamp:__.timestamp},The={"tag:yaml.org,2002:binary":S6.binary,"tag:yaml.org,2002:merge":If.merge,"tag:yaml.org,2002:omap":w6.omap,"tag:yaml.org,2002:pairs":x6.pairs,"tag:yaml.org,2002:set":$6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function Ohe(t,e,r){let n=y6.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(y6.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"?_6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(_6).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},[])}QT.coreKnownTags=The;QT.getTags=Ohe});var rO=v(E6=>{"use strict";var eO=De(),Rhe=cl(),Ihe=ll(),Phe=Ef(),b_=k6(),Che=(t,e)=>t.keye.key?1:0,tO=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,eO.MAP,{value:Rhe.map}),Object.defineProperty(this,eO.SCALAR,{value:Phe.string}),Object.defineProperty(this,eO.SEQ,{value:Ihe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Che:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};E6.Schema=tO});var T6=v(A6=>{"use strict";var Dhe=De(),nO=xf(),Pf=bf();function Nhe(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=nO.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(Dhe.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=nO.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(nO.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=o(t.comment);c.includes(` +${o.comment}`:n.comment}n=i}t.items[r]=c_.isPair(n)?n:new LO.Pair(n)}}else e("Expected a sequence for this tag");return t}function e6(t,e,r){let{replacer:n}=r,i=new Yme.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(LO.createPair(a,c,r))}return i}var Xme={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:QH,createNode:e6};l_.createPairs=e6;l_.pairs=Xme;l_.resolvePairs=QH});var qO=v(UO=>{"use strict";var t6=De(),zO=Wo(),Of=es(),Qme=ts(),r6=u_(),ya=class t extends Qme.YAMLSeq{constructor(){super(),this.add=Of.YAMLMap.prototype.add.bind(this),this.delete=Of.YAMLMap.prototype.delete.bind(this),this.get=Of.YAMLMap.prototype.get.bind(this),this.has=Of.YAMLMap.prototype.has.bind(this),this.set=Of.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(t6.isPair(i)?(o=zO.toJS(i.key,"",r),s=zO.toJS(i.value,o,r)):o=zO.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=r6.createPairs(e,r,n),o=new this;return o.items=i.items,o}};ya.tag="tag:yaml.org,2002:omap";var ehe={collection:"seq",identify:t=>t instanceof Map,nodeClass:ya,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=r6.resolvePairs(t,e),n=[];for(let{key:i}of r.items)t6.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)};UO.YAMLOMap=ya;UO.omap=ehe});var a6=v(HO=>{"use strict";var n6=Dt();function i6({value:t,source:e},r){return e&&(t?o6:s6).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var o6={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 n6.Scalar(!0),stringify:i6},s6={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 n6.Scalar(!1),stringify:i6};HO.falseTag=s6;HO.trueTag=o6});var c6=v(d_=>{"use strict";var the=Dt(),BO=ul(),rhe={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:BO.stringifyNumber},nhe={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():BO.stringifyNumber(t)}},ihe={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 the.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:BO.stringifyNumber};d_.float=ihe;d_.floatExp=nhe;d_.floatNaN=rhe});var u6=v(Rf=>{"use strict";var l6=ul(),Tf=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 GO(t,e,r){let{value:n}=t;if(Tf(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return l6.stringifyNumber(t)}var ohe={identify:Tf,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=>GO(t,2,"0b")},she={identify:Tf,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=>GO(t,8,"0")},ahe={identify:Tf,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>f_(t,0,10,r),stringify:l6.stringifyNumber},che={identify:Tf,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=>GO(t,16,"0x")};Rf.int=ahe;Rf.intBin=ohe;Rf.intHex=che;Rf.intOct=she});var VO=v(ZO=>{"use strict";var h_=De(),p_=Xo(),m_=es(),_a=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}};_a.tag="tag:yaml.org,2002:set";var lhe={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(h_.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}};ZO.YAMLSet=_a;ZO.set=lhe});var KO=v(g_=>{"use strict";var uhe=ul();function WO(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 d6(t){let{value:e}=t,r=s=>s;if(typeof e=="bigint")r=s=>BigInt(s);else if(isNaN(e)||!isFinite(e))return uhe.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 dhe={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})=>WO(t,r),stringify:d6},fhe={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=>WO(t,!1),stringify:d6},f6={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(f6.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=WO(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=fhe;g_.intTime=dhe;g_.timestamp=f6});var h6=v(m6=>{"use strict";var phe=cl(),mhe=n_(),hhe=ll(),ghe=Ef(),yhe=FO(),p6=a6(),JO=c6(),y_=u6(),_he=Ky(),bhe=qO(),vhe=u_(),She=VO(),YO=KO(),whe=[phe.map,hhe.seq,ghe.string,mhe.nullTag,p6.trueTag,p6.falseTag,y_.intBin,y_.intOct,y_.int,y_.intHex,JO.floatNaN,JO.floatExp,JO.float,yhe.binary,_he.merge,bhe.omap,vhe.pairs,She.set,YO.intTime,YO.floatTime,YO.timestamp];m6.schema=whe});var k6=v(eT=>{"use strict";var b6=cl(),xhe=n_(),v6=ll(),$he=Ef(),khe=RO(),XO=PO(),QO=DO(),Ehe=WH(),Ahe=YH(),S6=FO(),If=Ky(),w6=qO(),x6=u_(),g6=h6(),$6=VO(),__=KO(),y6=new Map([["core",Ehe.schema],["failsafe",[b6.map,v6.seq,$he.string]],["json",Ahe.schema],["yaml11",g6.schema],["yaml-1.1",g6.schema]]),_6={binary:S6.binary,bool:khe.boolTag,float:XO.float,floatExp:XO.floatExp,floatNaN:XO.floatNaN,floatTime:__.floatTime,int:QO.int,intHex:QO.intHex,intOct:QO.intOct,intTime:__.intTime,map:b6.map,merge:If.merge,null:xhe.nullTag,omap:w6.omap,pairs:x6.pairs,seq:v6.seq,set:$6.set,timestamp:__.timestamp},Ohe={"tag:yaml.org,2002:binary":S6.binary,"tag:yaml.org,2002:merge":If.merge,"tag:yaml.org,2002:omap":w6.omap,"tag:yaml.org,2002:pairs":x6.pairs,"tag:yaml.org,2002:set":$6.set,"tag:yaml.org,2002:timestamp":__.timestamp};function The(t,e,r){let n=y6.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(y6.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"?_6[s]:s;if(!a){let c=JSON.stringify(s),l=Object.keys(_6).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},[])}eT.coreKnownTags=Ohe;eT.getTags=The});var nT=v(E6=>{"use strict";var tT=De(),Rhe=cl(),Ihe=ll(),Phe=Ef(),b_=k6(),Che=(t,e)=>t.keye.key?1:0,rT=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,tT.MAP,{value:Rhe.map}),Object.defineProperty(this,tT.SCALAR,{value:Phe.string}),Object.defineProperty(this,tT.SEQ,{value:Ihe.seq}),this.sortMapEntries=typeof s=="function"?s:s===!0?Che:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};E6.Schema=rT});var O6=v(A6=>{"use strict";var Dhe=De(),iT=xf(),Pf=bf();function Nhe(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=iT.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(Dhe.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=iT.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(iT.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(` `)+` -`}A6.stringifyDocument=Nhe});var Cf=v(O6=>{"use strict";var jhe=yf(),dl=Ly(),Rn=De(),Mhe=Xo(),Fhe=Wo(),Lhe=rO(),zhe=T6(),iO=Ny(),Uhe=cT(),qhe=_f(),oO=aT(),sO=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 oO.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){fl(this.contents)&&this.contents.add(e)}addIn(e,r){fl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=iO.anchorNames(this);e.anchor=!r||n.has(r)?iO.findNewAnchor(r||"a",n):r}return new jhe.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}=iO.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=qhe.createNode(e,u,m);return a&&Rn.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 Mhe.Pair(i,o)}delete(e){return fl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):fl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return dl.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dl.isEmptyPath(e)?this.contents!==void 0:Rn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=dl.collectionFromPath(this.schema,[e],r):fl(this.contents)&&this.contents.set(e,r)}setIn(e,r){dl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=dl.collectionFromPath(this.schema,Array.from(e),r):fl(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 oO.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 oO.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 Lhe.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=Fhe.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"?Uhe.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 zhe.stringifyDocument(this,e)}};function fl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}O6.Document=sO});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}},aO=class extends Df{constructor(e,r,n){super("YAMLParseError",e,r,n)}},cO=class extends Df{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Hhe=(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 +`}A6.stringifyDocument=Nhe});var Cf=v(T6=>{"use strict";var jhe=yf(),dl=Ly(),Rn=De(),Mhe=Xo(),Fhe=Wo(),Lhe=nT(),zhe=O6(),oT=Ny(),Uhe=lO(),qhe=_f(),sT=cO(),aT=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Rn.NODE_TYPE,{value:Rn.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 sT.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,{[Rn.NODE_TYPE]:{value:Rn.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=Rn.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){fl(this.contents)&&this.contents.add(e)}addIn(e,r){fl(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=oT.anchorNames(this);e.anchor=!r||n.has(r)?oT.findNewAnchor(r||"a",n):r}return new jhe.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}=oT.createNodeAnchors(this,s||"a"),m={aliasDuplicateObjects:o??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=qhe.createNode(e,u,m);return a&&Rn.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 Mhe.Pair(i,o)}delete(e){return fl(this.contents)?this.contents.delete(e):!1}deleteIn(e){return dl.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):fl(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return Rn.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return dl.isEmptyPath(e)?!r&&Rn.isScalar(this.contents)?this.contents.value:this.contents:Rn.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return Rn.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return dl.isEmptyPath(e)?this.contents!==void 0:Rn.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=dl.collectionFromPath(this.schema,[e],r):fl(this.contents)&&this.contents.set(e,r)}setIn(e,r){dl.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=dl.collectionFromPath(this.schema,Array.from(e),r):fl(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 sT.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 sT.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 Lhe.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=Fhe.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"?Uhe.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 zhe.stringifyDocument(this,e)}};function fl(t){if(Rn.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}T6.Document=aT});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}},cT=class extends Df{constructor(e,r,n){super("YAMLParseError",e,r,n)}},lT=class extends Df{constructor(e,r,n){super("YAMLWarning",e,r,n)}},Hhe=(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} -`}};Nf.YAMLError=Df;Nf.YAMLParseError=aO;Nf.YAMLWarning=cO;Nf.prettifyError=Hhe});var Mf=v(R6=>{"use strict";function Bhe(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}}R6.resolveProps=Bhe});var v_=v(I6=>{"use strict";function lO(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(lO(e.key)||lO(e.value))return!0}return!1;default:return!0}}I6.containsNewline=lO});var uO=v(P6=>{"use strict";var Ghe=v_();function Zhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ghe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}P6.flowIndentCheck=Zhe});var dO=v(D6=>{"use strict";var C6=De();function Vhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||C6.isScalar(o)&&C6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}D6.mapIncludes=Vhe});var z6=v(L6=>{"use strict";var N6=Xo(),Whe=es(),j6=Mf(),Khe=v_(),M6=uO(),Jhe=dO(),F6="All mapping items must start at the same column";function Yhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Whe.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=j6.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",F6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` +`}};Nf.YAMLError=Df;Nf.YAMLParseError=cT;Nf.YAMLWarning=lT;Nf.prettifyError=Hhe});var Mf=v(R6=>{"use strict";function Bhe(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 O of t)switch(m&&(O.type!=="space"&&O.type!=="newline"&&O.type!=="comma"&&o(O.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),h&&(l&&O.type!=="comment"&&O.type!=="newline"&&o(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),O.type){case"space":!e&&(r!=="doc-start"||n?.type!=="flow-collection")&&O.source.includes(" ")&&(h=O),u=!0;break;case"comment":{u||o(O,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let D=O.source.substring(1)||" ";d?d+=f+D:d=D,f="",l=!1;break}case"newline":l?d?d+=O.source:(!x||r!=="seq-item-ind")&&(c=!0):f+=O.source,l=!0,p=!0,(g||b)&&(_=O),u=!0;break;case"anchor":g&&o(O,"MULTIPLE_ANCHORS","A node can have at most one anchor"),O.source.endsWith(":")&&o(O.offset+O.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=O,w??(w=O.offset),l=!1,u=!1,m=!0;break;case"tag":{b&&o(O,"MULTIPLE_TAGS","A node can have at most one tag"),b=O,w??(w=O.offset),l=!1,u=!1,m=!0;break}case r:(g||b)&&o(O,"BAD_PROP_ORDER",`Anchors and tags must be after the ${O.source} indicator`),x&&o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.source} in ${e??"collection"}`),x=O,l=r==="seq-item-ind"||r==="explicit-key-ind",u=!1;break;case"comma":if(e){S&&o(O,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=O,l=!1,u=!1;break}default:o(O,"UNEXPECTED_TOKEN",`Unexpected ${O.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}}R6.resolveProps=Bhe});var v_=v(I6=>{"use strict";function uT(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(uT(e.key)||uT(e.value))return!0}return!1;default:return!0}}I6.containsNewline=uT});var dT=v(P6=>{"use strict";var Ghe=v_();function Zhe(t,e,r){if(e?.type==="flow-collection"){let n=e.end[0];n.indent===t&&(n.source==="]"||n.source==="}")&&Ghe.containsNewline(e)&&r(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}P6.flowIndentCheck=Zhe});var fT=v(D6=>{"use strict";var C6=De();function Vhe(t,e,r){let{uniqueKeys:n}=t.options;if(n===!1)return!1;let i=typeof n=="function"?n:(o,s)=>o===s||C6.isScalar(o)&&C6.isScalar(s)&&o.value===s.value;return e.some(o=>i(o.key,r))}D6.mapIncludes=Vhe});var z6=v(L6=>{"use strict";var N6=Xo(),Whe=es(),j6=Mf(),Khe=v_(),M6=dT(),Jhe=fT(),F6="All mapping items must start at the same column";function Yhe({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Whe.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=j6.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",F6)),!h.anchor&&!h.tag&&!p){l=h.end,h.comment&&(a.comment?a.comment+=` `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Khe.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",F6);r.atKey=!0;let b=h.end,_=f?t(r,f,h,i):e(r,b,d,null,h,i);r.schema.compat&&M6.flowIndentCheck(n.indent,f,i),r.atKey=!1,Jhe.mapIncludes(r,a.items,_)&&i(b,"DUPLICATE_KEY","Map keys must be unique");let S=j6.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 Xhe=ts(),Qhe=Mf(),ege=uO();function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xhe.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=Qhe.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&&ege.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}U6.resolveBlockSeq=tge});var pl=v(H6=>{"use strict";function rge(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}}H6.resolveEnd=rge});var V6=v(Z6=>{"use strict";var nge=De(),ige=Xo(),B6=es(),oge=ts(),sge=pl(),G6=Mf(),age=v_(),cge=dO(),fO="Block collections are not allowed within flow collections",pO=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?B6.YAMLMap:oge.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=sge.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` -`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Z6.resolveFlowCollection=lge});var K6=v(W6=>{"use strict";var uge=De(),dge=Dt(),fge=es(),pge=ts(),mge=z6(),hge=q6(),gge=V6();function mO(t,e,r,n,i,o){let s=r.type==="block-map"?mge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?hge.resolveBlockSeq(t,e,r,n,o):gge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function yge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),mO(t,e,r,i,s)}let l=mO(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=uge.isNode(u)?u:new dge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}W6.composeCollection=yge});var gO=v(J6=>{"use strict";var hO=Dt();function _ge(t,e,r){let n=e.offset,i=bge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?hO.Scalar.BLOCK_FOLDED:hO.Scalar.BLOCK_LITERAL,s=e.source?vge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` +`+S.comment:_.comment=S.comment);let x=new N6.Pair(_);r.options.keepSourceTokens&&(x.srcToken=u),a.items.push(x)}}return l&&l{"use strict";var Xhe=ts(),Qhe=Mf(),ege=dT();function tge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=o?.nodeClass??Xhe.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=Qhe.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&&ege.flowIndentCheck(n.indent,d,i),c=p.range[2],a.items.push(p)}return a.range=[n.offset,c,l??c],a}U6.resolveBlockSeq=tge});var pl=v(H6=>{"use strict";function rge(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}}H6.resolveEnd=rge});var V6=v(Z6=>{"use strict";var nge=De(),ige=Xo(),B6=es(),oge=ts(),sge=pl(),G6=Mf(),age=v_(),cge=fT(),pT="Block collections are not allowed within flow collections",mT=t=>t&&(t.type==="block-map"||t.type==="block-seq");function lge({composeNode:t,composeEmptyNode:e},r,n,i,o){let s=n.start.source==="{",a=s?"flow map":"flow sequence",c=o?.nodeClass??(s?B6.YAMLMap:oge.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=sge.resolveEnd(m,h,r.options.strict,i);g.comment&&(l.comment?l.comment+=` +`+g.comment:l.comment=g.comment),l.range=[n.offset,h,g.offset]}else l.range=[n.offset,h,h];return l}Z6.resolveFlowCollection=lge});var K6=v(W6=>{"use strict";var uge=De(),dge=Dt(),fge=es(),pge=ts(),mge=z6(),hge=q6(),gge=V6();function hT(t,e,r,n,i,o){let s=r.type==="block-map"?mge.resolveBlockMap(t,e,r,n,o):r.type==="block-seq"?hge.resolveBlockSeq(t,e,r,n,o):gge.resolveFlowCollection(t,e,r,n,o),a=s.constructor;return i==="!"||i===a.tagName?(s.tag=a.tagName,s):(i&&(s.tag=i),s)}function yge(t,e,r,n,i){let o=n.tag,s=o?e.directives.tagName(o.source,f=>i(o,"TAG_RESOLVE_FAILED",f)):null;if(r.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=n,m=f&&o?f.offset>o.offset?f:o:f??o;m&&(!p||p.offsetf.tag===s&&f.collection===a);if(!c){let f=e.schema.knownTags[s];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?i(o,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):i(o,"TAG_RESOLVE_FAILED",`Unresolved tag: ${s}`,!0),hT(t,e,r,i,s)}let l=hT(t,e,r,i,s,c),u=c.resolve?.(l,f=>i(o,"TAG_RESOLVE_FAILED",f),e.options)??l,d=uge.isNode(u)?u:new dge.Scalar(u);return d.range=l.range,d.tag=s,c?.format&&(d.format=c.format),d}W6.composeCollection=yge});var yT=v(J6=>{"use strict";var gT=Dt();function _ge(t,e,r){let n=e.offset,i=bge(e,t.options.strict,r);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};let o=i.mode===">"?gT.Scalar.BLOCK_FOLDED:gT.Scalar.BLOCK_LITERAL,s=e.source?vge(e.source):[],a=s.length;for(let h=s.length-1;h>=0;--h){let g=s[h][1];if(g===""||g==="\r")a=h;else break}if(a===0){let h=i.chomp==="+"&&s.length>0?` `.repeat(Math.max(1,s.length-1)):"",g=n+i.length;return e.source&&(g+=e.source.length),{value:h,type:o,comment:i.comment,range:[n,g,g]}}let c=e.indent+i.indent,l=e.offset+i.length,u=0;for(let h=0;hc&&(c=g.length);else{g.length=a;--h)s[h][0].length>c&&(a=h+1);let d="",f="",p=!1;for(let h=0;hc||b[0]===" "?(f===" "?f=` `:!p&&f===` `&&(f=` @@ -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 bge({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 yO=Dt(),Sge=pl();function wge(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=yO.Scalar.PLAIN,c=xge(o,l);break;case"single-quoted-scalar":a=yO.Scalar.QUOTE_SINGLE,c=$ge(o,l);break;case"double-quoted-scalar":a=yO.Scalar.QUOTE_DOUBLE,c=kge(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=Sge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function xge(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}`),Y6(t)}function $ge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Y6(t.slice(1,-1)).replace(/''/g,"'")}function Y6(t){let e,r;try{e=new RegExp(`(.*?)(?{"use strict";var _T=Dt(),Sge=pl();function wge(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=_T.Scalar.PLAIN,c=xge(o,l);break;case"single-quoted-scalar":a=_T.Scalar.QUOTE_SINGLE,c=$ge(o,l);break;case"double-quoted-scalar":a=_T.Scalar.QUOTE_DOUBLE,c=kge(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=Sge.resolveEnd(s,u,e,r);return{value:c,type:a,comment:d.comment,range:[n,u,d.offset]}}function xge(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}`),Y6(t)}function $ge(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),Y6(t.slice(1,-1)).replace(/''/g,"'")}function Y6(t){let e,r;try{e=new RegExp(`(.*?)(?o?t.slice(o,n+1):i)}else r+=i}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),r}function Ege(t,e){let r="",n=t[e+1];for(;(n===" "||n===" "||n===` `||n==="\r")&&!(n==="\r"&&t[e+2]!==` `);)n===` `&&(r+=` `),e+=1,n=t[e+1];return r||(r=" "),{fold:r,offset:e}}var Age={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` -`,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Tge(t,e,r,n){let i=t.substr(e,r),s=i.length===r&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(s)}catch{let a=t.substr(e-2,r+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}X6.resolveFlowScalar=wge});var tB=v(eB=>{"use strict";var ba=De(),Q6=Dt(),Oge=gO(),Rge=_O();function Ige(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Oge.resolveBlockScalar(t,e,n):Rge.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=Pge(t.schema,i,c,r,n):e.type==="scalar"?l=Cge(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 Q6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new Q6.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 Pge(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 Cge({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}eB.composeScalar=Ige});var nB=v(rB=>{"use strict";function Dge(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}rB.emptyScalarPosition=Dge});var sB=v(vO=>{"use strict";var Nge=yf(),jge=De(),Mge=K6(),iB=tB(),Fge=pl(),Lge=nB(),zge={composeNode:oB,composeEmptyNode:bO};function oB(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=Uge(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=iB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Mge.composeCollection(zge,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=bO(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&&(!jge.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 bO(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Lge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=iB.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 Uge({options:t},{offset:e,source:r,end:n},i){let o=new Nge.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=Fge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}vO.composeEmptyNode=bO;vO.composeNode=oB});var lB=v(cB=>{"use strict";var qge=Cf(),aB=sB(),Hge=pl(),Bge=Mf();function Gge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Bge.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?aB.composeNode(l,i,u,s):aB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Hge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}cB.composeDoc=Gge});var wO=v(fB=>{"use strict";var Zge=Ze("process"),Vge=aT(),Wge=Cf(),Ff=jf(),uB=De(),Kge=lB(),Jge=pl();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 dB(t){let e="",r=!1,n=!1;for(let i=0;i{"use strict";var ba=De(),Q6=Dt(),Tge=yT(),Rge=bT();function Ige(t,e,r,n){let{value:i,type:o,comment:s,range:a}=e.type==="block-scalar"?Tge.resolveBlockScalar(t,e,n):Rge.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=Pge(t.schema,i,c,r,n):e.type==="scalar"?l=Cge(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 Q6.Scalar(d)}catch(d){let f=d instanceof Error?d.message:String(d);n(r??e,"TAG_RESOLVE_FAILED",f),u=new Q6.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 Pge(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 Cge({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}eB.composeScalar=Ige});var nB=v(rB=>{"use strict";function Dge(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}rB.emptyScalarPosition=Dge});var sB=v(ST=>{"use strict";var Nge=yf(),jge=De(),Mge=K6(),iB=tB(),Fge=pl(),Lge=nB(),zge={composeNode:oB,composeEmptyNode:vT};function oB(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=Uge(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=iB.composeScalar(t,e,c,n),a&&(l.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{l=Mge.composeCollection(zge,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=vT(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&&(!jge.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 vT(t,e,r,n,{spaceBefore:i,comment:o,anchor:s,tag:a,end:c},l){let u={type:"scalar",offset:Lge.emptyScalarPosition(e,r,n),indent:-1,source:""},d=iB.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 Uge({options:t},{offset:e,source:r,end:n},i){let o=new Nge.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=Fge.resolveEnd(n,s,t.strict,i);return o.range=[e,s,a.offset],a.comment&&(o.comment=a.comment),o}ST.composeEmptyNode=vT;ST.composeNode=oB});var lB=v(cB=>{"use strict";var qge=Cf(),aB=sB(),Hge=pl(),Bge=Mf();function Gge(t,e,{offset:r,start:n,value:i,end:o},s){let a=Object.assign({_directives:e},t),c=new qge.Document(void 0,a),l={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},u=Bge.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?aB.composeNode(l,i,u,s):aB.composeEmptyNode(l,u.end,n,null,u,s);let d=c.contents.range[2],f=Hge.resolveEnd(o,d,!1,s);return f.comment&&(c.comment=f.comment),c.range=[r,d,f.offset],c}cB.composeDoc=Gge});var xT=v(fB=>{"use strict";var Zge=Ze("process"),Vge=cO(),Wge=Cf(),Ff=jf(),uB=De(),Kge=lB(),Jge=pl();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 dB(t){let e="",r=!1,n=!1;for(let i=0;i{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 Vge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=dB(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 wT=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 Vge.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,r){let{comment:n,afterEmptyLine:i}=dB(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(uB.isCollection(o)&&!o.flow&&o.items.length>0){let s=o.items[0];uB.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=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=Kge.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 Wge.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}}};fB.Composer=SO});var hB=v(S_=>{"use strict";var Yge=gO(),Xge=_O(),Qge=jf(),pB=wf();function eye(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 Qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Xge.resolveFlowScalar(t,e,n);case"block-scalar":return Yge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function tye(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=pB.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:` +${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 Wge.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}}};fB.Composer=wT});var hB=v(S_=>{"use strict";var Yge=yT(),Xge=bT(),Qge=jf(),pB=wf();function eye(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 Qge.YAMLParseError([a,a+1],o,s)};switch(t.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Xge.resolveFlowScalar(t,e,n);case"block-scalar":return Yge.resolveBlockScalar({options:{strict:e}},t,n)}}return null}function tye(t,e){let{implicitKey:r=!1,indent:n,inFlow:i=!1,offset:o=-1,type:s="PLAIN"}=e,a=pB.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 mB(f,c)||f.push({type:"newline",offset:-1,indent:n,source:` -`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function rye(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=pB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":nye(t,c);break;case'"':xO(t,c,"double-quoted-scalar");break;case"'":xO(t,c,"single-quoted-scalar");break;default:xO(t,c,"scalar")}}function nye(t,e){let r=e.indexOf(` +`}),{type:"block-scalar",offset:o,indent:n,props:f,source:d}}case'"':return{type:"double-quoted-scalar",offset:o,indent:n,source:a,end:c};case"'":return{type:"single-quoted-scalar",offset:o,indent:n,source:a,end:c};default:return{type:"scalar",offset:o,indent:n,source:a,end:c}}}function rye(t,e,r={}){let{afterKey:n=!1,implicitKey:i=!1,inFlow:o=!1,type:s}=r,a="indent"in t?t.indent:null;if(n&&typeof a=="number"&&(a+=2),!s)switch(t.type){case"single-quoted-scalar":s="QUOTE_SINGLE";break;case"double-quoted-scalar":s="QUOTE_DOUBLE";break;case"block-scalar":{let l=t.props[0];if(l.type!=="block-scalar-header")throw new Error("Invalid block scalar header");s=l.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:s="PLAIN"}let c=pB.stringifyString({type:s,value:e},{implicitKey:i||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:o,options:{blockQuote:!0,lineWidth:-1}});switch(c[0]){case"|":case">":nye(t,c);break;case'"':$T(t,c,"double-quoted-scalar");break;case"'":$T(t,c,"single-quoted-scalar");break;default:$T(t,c,"scalar")}}function nye(t,e){let r=e.indexOf(` `),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}];mB(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 mB(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 xO(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})}}}S_.createScalarToken=tye;S_.resolveAsScalar=eye;S_.setScalarValue=rye});var yB=v(gB=>{"use strict";var iye=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}gB.stringify=iye});var SB=v(vB=>{"use strict";var $O=Symbol("break visit"),oye=Symbol("skip children"),_B=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),bB(Object.freeze([]),t,e)}va.BREAK=$O;va.SKIP=oye;va.REMOVE=_B;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 bB(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 kO=hB(),sye=yB(),aye=SB(),EO="\uFEFF",AO="",TO="",OO="",cye=t=>!!t&&"items"in t,lye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function uye(t){switch(t){case EO:return"";case AO:return"";case TO:return"";case OO:return"";default:return JSON.stringify(t)}}function dye(t){switch(t){case EO:return"byte-order-mark";case AO:return"doc-mode";case TO:return"flow-error-end";case OO:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` +`});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 mB(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 $T(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})}}}S_.createScalarToken=tye;S_.resolveAsScalar=eye;S_.setScalarValue=rye});var yB=v(gB=>{"use strict";var iye=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}gB.stringify=iye});var SB=v(vB=>{"use strict";var kT=Symbol("break visit"),oye=Symbol("skip children"),_B=Symbol("remove item");function va(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),bB(Object.freeze([]),t,e)}va.BREAK=kT;va.SKIP=oye;va.REMOVE=_B;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 bB(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 ET=hB(),sye=yB(),aye=SB(),AT="\uFEFF",OT="",TT="",RT="",cye=t=>!!t&&"items"in t,lye=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function uye(t){switch(t){case AT:return"";case OT:return"";case TT:return"";case RT:return"";default:return JSON.stringify(t)}}function dye(t){switch(t){case AT:return"byte-order-mark";case OT:return"doc-mode";case TT:return"flow-error-end";case RT: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=kO.createScalarToken;Mr.resolveAsScalar=kO.resolveAsScalar;Mr.setScalarValue=kO.setScalarValue;Mr.stringify=sye.stringify;Mr.visit=aye.visit;Mr.BOM=EO;Mr.DOCUMENT=AO;Mr.FLOW_END=TO;Mr.SCALAR=OO;Mr.isCollection=cye;Mr.isScalar=lye;Mr.prettyToken=uye;Mr.tokenType=dye});var PO=v(xB=>{"use strict";var zf=$_();function Qn(t){switch(t){case void 0:case" ":case` +`: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=ET.createScalarToken;Mr.resolveAsScalar=ET.resolveAsScalar;Mr.setScalarValue=ET.setScalarValue;Mr.stringify=sye.stringify;Mr.visit=aye.visit;Mr.BOM=AT;Mr.DOCUMENT=OT;Mr.FLOW_END=TT;Mr.SCALAR=RT;Mr.isCollection=cye;Mr.isScalar=lye;Mr.prettyToken=uye;Mr.tokenType=dye});var CT=v(xB=>{"use strict";var zf=$_();function Qn(t){switch(t){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var wB=new Set("0123456789ABCDEFabcdef"),fye=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),k_=new Set(",[]{}"),pye=new Set(` ,[]{} -\r `),RO=t=>!t||pye.has(t),IO=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===` +\r `),IT=t=>!t||pye.has(t),PT=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(RO),"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(IT),"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===` @@ -161,37 +161,37 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus `&&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&&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(RO),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(fye.has(r))r=this.buffer[++e];else if(r==="%"&&wB.has(this.buffer[e+1])&&wB.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===` +`){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(IT),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(fye.has(r))r=this.buffer[++e];else if(r==="%"&&wB.has(this.buffer[e+1])&&wB.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)}};xB.Lexer=IO});var DO=v($B=>{"use strict";var CO=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 mye=Ze("process"),kB=$_(),hye=PO();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"&&AB(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&&EB(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)}};xB.Lexer=PT});var NT=v($B=>{"use strict";var DT=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 mye=Ze("process"),kB=$_(),hye=CT();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"&&AB(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&&EB(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(TB(r.key)&&!rs(r.sep,"newline")){let s=ml(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=ml(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=ml(i);AB(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(OB(r.key)&&!rs(r.sep,"newline")){let s=ml(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=ml(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=ml(i);AB(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=E_(e),n=ml(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=ml(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())}}};OB.Parser=NO});var DB=v(qf=>{"use strict";var RB=wO(),gye=Cf(),Uf=jf(),yye=vT(),_ye=De(),bye=DO(),IB=jO();function PB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bye.LineCounter||null,prettyErrors:e}}function vye(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 CB(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 Sye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=CB(t,r);if(!i)return null;if(i.warnings.forEach(o=>yye.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 wye(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 _ye.isDocument(t)&&!n?t.toString(r):new gye.Document(t,n,r).toString(r)}qf.parse=Sye;qf.parseAllDocuments=vye;qf.parseDocument=CB;qf.stringify=wye});var tr=v(Ve=>{"use strict";var xye=wO(),$ye=Cf(),kye=rO(),MO=jf(),Eye=yf(),ns=De(),Aye=Xo(),Tye=Dt(),Oye=es(),Rye=ts(),Iye=$_(),Pye=PO(),Cye=DO(),Dye=jO(),T_=DB(),NB=pf();Ve.Composer=xye.Composer;Ve.Document=$ye.Document;Ve.Schema=kye.Schema;Ve.YAMLError=MO.YAMLError;Ve.YAMLParseError=MO.YAMLParseError;Ve.YAMLWarning=MO.YAMLWarning;Ve.Alias=Eye.Alias;Ve.isAlias=ns.isAlias;Ve.isCollection=ns.isCollection;Ve.isDocument=ns.isDocument;Ve.isMap=ns.isMap;Ve.isNode=ns.isNode;Ve.isPair=ns.isPair;Ve.isScalar=ns.isScalar;Ve.isSeq=ns.isSeq;Ve.Pair=Aye.Pair;Ve.Scalar=Tye.Scalar;Ve.YAMLMap=Oye.YAMLMap;Ve.YAMLSeq=Rye.YAMLSeq;Ve.CST=Iye;Ve.Lexer=Pye.Lexer;Ve.LineCounter=Cye.LineCounter;Ve.Parser=Dye.Parser;Ve.parse=T_.parse;Ve.parseAllDocuments=T_.parseAllDocuments;Ve.parseDocument=T_.parseDocument;Ve.stringify=T_.stringify;Ve.visit=NB.visit;Ve.visitAsync=NB.visitAsync});import{execFileSync as FO}from"node:child_process";import{existsSync as O_}from"node:fs";import{join as R_,resolve as Nye}from"node:path";function jye(t){try{let e=FO("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Nye(t,e):null}catch{return null}}function LO(t){let e=jye(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 Sa(t){return LO(t)!==null}function Hf(t,e){try{let r=FO("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 jB(t,e){try{let r=FO("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 Mye}from"node:child_process";import{existsSync as Fye,readFileSync as Lye}from"node:fs";import{join as FB}from"node:path";function yl(t,e){return Mye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=yl(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){LB(t,e);let r=yl(t,["rev-parse","HEAD"]).trim(),n=zye(t,e);return{groups:Uye(t,n),head:r,inventory:{after:MB(C_(t,"spec.yaml")),before:MB(Bf(t,e,"spec.yaml"))},since:e,unsharded_commits:Gye(t,e)}}function zO(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 LB(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 zye(t,e){let r=yl(t,["diff","--name-status",`${e}..HEAD`,"--","spec/"]),n=[];for(let i of r.split(` +`,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=ml(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=ml(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())}}};TB.Parser=jT});var DB=v(qf=>{"use strict";var RB=xT(),gye=Cf(),Uf=jf(),yye=SO(),_ye=De(),bye=NT(),IB=MT();function PB(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bye.LineCounter||null,prettyErrors:e}}function vye(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 CB(t,e={}){let{lineCounter:r,prettyErrors:n}=PB(e),i=new IB.Parser(r?.addNewLine),o=new RB.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 Sye(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=CB(t,r);if(!i)return null;if(i.warnings.forEach(o=>yye.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 wye(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 _ye.isDocument(t)&&!n?t.toString(r):new gye.Document(t,n,r).toString(r)}qf.parse=Sye;qf.parseAllDocuments=vye;qf.parseDocument=CB;qf.stringify=wye});var tr=v(Ve=>{"use strict";var xye=xT(),$ye=Cf(),kye=nT(),FT=jf(),Eye=yf(),ns=De(),Aye=Xo(),Oye=Dt(),Tye=es(),Rye=ts(),Iye=$_(),Pye=CT(),Cye=NT(),Dye=MT(),O_=DB(),NB=pf();Ve.Composer=xye.Composer;Ve.Document=$ye.Document;Ve.Schema=kye.Schema;Ve.YAMLError=FT.YAMLError;Ve.YAMLParseError=FT.YAMLParseError;Ve.YAMLWarning=FT.YAMLWarning;Ve.Alias=Eye.Alias;Ve.isAlias=ns.isAlias;Ve.isCollection=ns.isCollection;Ve.isDocument=ns.isDocument;Ve.isMap=ns.isMap;Ve.isNode=ns.isNode;Ve.isPair=ns.isPair;Ve.isScalar=ns.isScalar;Ve.isSeq=ns.isSeq;Ve.Pair=Aye.Pair;Ve.Scalar=Oye.Scalar;Ve.YAMLMap=Tye.YAMLMap;Ve.YAMLSeq=Rye.YAMLSeq;Ve.CST=Iye;Ve.Lexer=Pye.Lexer;Ve.LineCounter=Cye.LineCounter;Ve.Parser=Dye.Parser;Ve.parse=O_.parse;Ve.parseAllDocuments=O_.parseAllDocuments;Ve.parseDocument=O_.parseDocument;Ve.stringify=O_.stringify;Ve.visit=NB.visit;Ve.visitAsync=NB.visitAsync});import{execFileSync as LT}from"node:child_process";import{existsSync as T_}from"node:fs";import{join as R_,resolve as Nye}from"node:path";function jye(t){try{let e=LT("git",["rev-parse","--git-dir"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim();return e?Nye(t,e):null}catch{return null}}function zT(t){let e=jye(t);if(!e)return null;try{if(T_(R_(e,"MERGE_HEAD")))return"merge";if(T_(R_(e,"CHERRY_PICK_HEAD")))return"cherry-pick";if(T_(R_(e,"rebase-merge"))||T_(R_(e,"rebase-apply")))return"rebase"}catch{return null}return null}function Sa(t){return zT(t)!==null}function Hf(t,e){try{let r=LT("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 jB(t,e){try{let r=LT("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 Mye}from"node:child_process";import{existsSync as Fye,readFileSync as Lye}from"node:fs";import{join as FB}from"node:path";function yl(t,e){return Mye("git",[...e],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","pipe"]})}function is(t){try{let e=yl(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){LB(t,e);let r=yl(t,["rev-parse","HEAD"]).trim(),n=zye(t,e);return{groups:Uye(t,n),head:r,inventory:{after:MB(C_(t,"spec.yaml")),before:MB(Bf(t,e,"spec.yaml"))},since:e,unsharded_commits:Gye(t,e)}}function UT(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 LB(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 zye(t,e){let r=yl(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=gl(C_(t,c));if(!l)continue;l.status==="done"?n.push(hl(l,"added-as-done")):l.status==="archived"&&n.push(hl(l,"archived"))}else if(s.startsWith("D")){let l=gl(Bf(t,e,a));l&&n.push(hl(l,"archived"))}else{let l=gl(C_(t,c));if(!l)continue;let d=gl(Bf(t,e,a))?.status;l.status==="done"&&d!=="done"?n.push(hl(l,"flipped-to-done")):l.status==="done"&&d==="done"?n.push(hl(l,"modified-while-done")):l.status==="archived"&&d!=="archived"&&n.push(hl(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 zB(t,e){LB(t,e);let r=yl(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?gl(Bf(t,"HEAD",c)):null,f=l?null:gl(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 hl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>zO(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function gl(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=FB(t,e);if(!Fye(r))return null;try{return Lye(r,"utf8")}catch{return null}}function Bf(t,e,r){try{return yl(t,["show",`${e}:${r}`])}catch{return null}}function Uye(t,e){let r=qye(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 qye(t){let e=C_(t,FB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function MB(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 Gye(t,e){let r=yl(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);Hye.test(a)&&(Bye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Hye,Bye,_l=y(()=>{"use strict";D_=wt(tr(),1);wa();Hye=/^(feat|fix)(\([^)]*\))?!?:/,Bye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as UB}from"node:child_process";import{appendFileSync as Zye,existsSync as UO,mkdirSync as Vye,readFileSync as Wye,renameSync as Kye,statSync as Jye}from"node:fs";import{userInfo as Yye}from"node:os";import{dirname as Xye,join as HO}from"node:path";function BO(t){return HO(t,qB,Qye)}function rn(t,e){let r=BO(t),n=Xye(r);UO(n)||Vye(n,{recursive:!0});try{UO(r)&&Jye(r).size>e_e&&Kye(r,HO(n,HB))}catch{}Zye(r,`${JSON.stringify(e)} -`,"utf8")}function qO(t){if(!UO(t))return[];let e=Wye(t,"utf8").trim();return e.length===0?[]:e.split(` -`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return qO(BO(t))}function N_(t){return[...qO(HO(t,qB,HB)),...qO(BO(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 t_e(t){let e;try{e=UB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Yye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function r_e(t){try{return UB("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=r_e(t),i=t_e(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 qB,Qye,HB,e_e,Fr=y(()=>{"use strict";qB=".cladding",Qye="events.log.jsonl",HB="events.log.1.jsonl",e_e=5*1024*1024});import{execFileSync as n_e}from"node:child_process";import{existsSync as BB,readdirSync as i_e,readFileSync as o_e,statSync as GB}from"node:fs";import{createHash as s_e}from"node:crypto";import{join as GO}from"node:path";function xa(t){try{return n_e("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function ZO(t){let e=[],r=GO(t,"spec.yaml");BB(r)&&GB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=GO(t,"spec",i);if(!(!BB(o)||!GB(o).isDirectory()))for(let s of i_e(o))s.endsWith(".yaml")&&e.push(GO(o,s))}e.sort();let n=s_e("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(o_e(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:ZO(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 a_e,statSync as c_e}from"node:fs";import{extname as l_e,resolve as VO,sep as u_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function p_e(t,e){let r=VO(e),n=VO(r,t);return n===r||n.startsWith(r+u_e)}function VB(t,e,r,n){if(!p_e(t,e))return{path:t,omitted:"unsafe-path"};if(!d_e.has(l_e(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>ZB)return{path:t,omitted:"too-large",bytes:o}}else{let l=VO(e,t);try{o=c_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>ZB)return{path:t,omitted:"too-large",bytes:o};try{i=a_e(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(f_e))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=` +`)){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?gl(Bf(t,"HEAD",c)):null,f=l?null:gl(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 hl(t,e){return{acceptance:(t.acceptance_criteria??[]).map(n=>UT(n)).filter(n=>n!==null),change:e,id:t.id,...t.slug?{slug:t.slug}:{},title:t.title}}function gl(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=FB(t,e);if(!Fye(r))return null;try{return Lye(r,"utf8")}catch{return null}}function Bf(t,e,r){try{return yl(t,["show",`${e}:${r}`])}catch{return null}}function Uye(t,e){let r=qye(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 qye(t){let e=C_(t,FB("spec","capabilities.yaml"));if(e===null)return[];try{let r=(0,D_.parse)(e);return Array.isArray(r?.capabilities)?r.capabilities:[]}catch{return[]}}function MB(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 Gye(t,e){let r=yl(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);Hye.test(a)&&(Bye.test(a)||n.push({hash:s,subject:a}))}return n}var D_,Hye,Bye,_l=y(()=>{"use strict";D_=wt(tr(),1);wa();Hye=/^(feat|fix)(\([^)]*\))?!?:/,Bye=/\bF-(\d{3,}|[a-f0-9]{6,})\b/});import{execFileSync as UB}from"node:child_process";import{appendFileSync as Zye,existsSync as qT,mkdirSync as Vye,readFileSync as Wye,renameSync as Kye,statSync as Jye}from"node:fs";import{userInfo as Yye}from"node:os";import{dirname as Xye,join as BT}from"node:path";function GT(t){return BT(t,qB,Qye)}function rn(t,e){let r=GT(t),n=Xye(r);qT(n)||Vye(n,{recursive:!0});try{qT(r)&&Jye(r).size>e_e&&Kye(r,BT(n,HB))}catch{}Zye(r,`${JSON.stringify(e)} +`,"utf8")}function HT(t){if(!qT(t))return[];let e=Wye(t,"utf8").trim();return e.length===0?[]:e.split(` +`).filter(r=>r.length>0).map(r=>JSON.parse(r))}function ss(t){return HT(GT(t))}function N_(t){return[...HT(BT(t,qB,HB)),...HT(GT(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 t_e(t){let e;try{e=UB("git",["config","user.name"],{cwd:t,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim()||void 0}catch{}if(!e)try{e=Yye().username}catch{e=void 0}return{author:"human",name:e,timestamp:new Date().toISOString()}}function r_e(t){try{return UB("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=r_e(t),i=t_e(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 qB,Qye,HB,e_e,Fr=y(()=>{"use strict";qB=".cladding",Qye="events.log.jsonl",HB="events.log.1.jsonl",e_e=5*1024*1024});import{execFileSync as n_e}from"node:child_process";import{existsSync as BB,readdirSync as i_e,readFileSync as o_e,statSync as GB}from"node:fs";import{createHash as s_e}from"node:crypto";import{join as ZT}from"node:path";function xa(t){try{return n_e("git",["rev-parse","HEAD"],{cwd:t,stdio:["ignore","pipe","ignore"]}).toString("utf8").trim()||null}catch{return null}}function VT(t){let e=[],r=ZT(t,"spec.yaml");BB(r)&&GB(r).isFile()&&e.push(r);for(let i of["features","scenarios"]){let o=ZT(t,"spec",i);if(!(!BB(o)||!GB(o).isDirectory()))for(let s of i_e(o))s.endsWith(".yaml")&&e.push(ZT(o,s))}e.sort();let n=s_e("sha256");for(let i of e){let o=i.slice(t.length+1);n.update(`${o}\0`),n.update(o_e(i)),n.update("\0")}return n.digest("hex")}function j_(t,e){let r={featureId:e,gitHead:xa(t),specDigest:VT(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 a_e,statSync as c_e}from"node:fs";import{extname as l_e,resolve as WT,sep as u_e}from"node:path";function on(t){return Math.ceil(t.length/4)}function p_e(t,e){let r=WT(e),n=WT(r,t);return n===r||n.startsWith(r+u_e)}function VB(t,e,r,n){if(!p_e(t,e))return{path:t,omitted:"unsafe-path"};if(!d_e.has(l_e(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>ZB)return{path:t,omitted:"too-large",bytes:o}}else{let l=WT(e,t);try{o=c_e(l).size}catch{return{path:t,omitted:"missing"}}if(o>ZB)return{path:t,omitted:"too-large",bytes:o};try{i=a_e(l,"utf8")}catch{return{path:t,omitted:"missing",bytes:o}}}if(i.includes(f_e))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 d_e,ZB,f_e,L_=y(()=>{"use strict";d_e=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"]),ZB=2e6,f_e="\0"});function Vf(t){for(let i of m_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 WO(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function h_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??[])WO(e,s,o);for(let s of i.modules??[])WO(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vf(a);c&&WO(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=WB.get(t);return e||(e=h_e(t),WB.set(t,e)),e}var m_e,WB,as=y(()=>{"use strict";m_e=["derived:","fixture:","script:","self-dogfood:"];WB=new WeakMap});function KO(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=g_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=KO(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:JO(i)}}var $a=y(()=>{"use strict";as()});function KB(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=In(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=KO(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=KB(_),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_,YO=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function y_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 JB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=y_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 YB=y(()=>{"use strict"});function __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 bl(t,e){let r=__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=JB(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";YB()});import{existsSync as QB,readdirSync as b_e,readFileSync as v_e}from"node:fs";import{join as QO}from"node:path";function eR(t,e=w_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function x_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:eR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:eR(`done reverted \u2014 pre-push strict gate red${r}`)}}function XB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function $_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 eR(n)}function k_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)=>XB(m)-XB(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(-S_e).map(x_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?$_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 XO(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function E_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 A_e(t,e,r){let n=XO(t,/_Rolled back at_\s*`([^`]+)`/),i=XO(t,/Last failed gate:\s*`([^`]+)`/),o=XO(t,/Retry attempts:\s*(\d+)/),s=E_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function T_e(t,e){let r=QO(t,".cladding","post-mortems");if(!QB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of b_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(A_e(v_e(QO(r,o),"utf8"),e,o))}catch{}return i}function eG(t,e){try{let r=N_(t),n=T_e(t,e),i=QB(QO(t,".cladding","events.log.1.jsonl"));return k_e(r,n,e,{truncated:i})}catch{return}}var S_e,w_e,tG=y(()=>{"use strict";Fr();S_e=5,w_e=120});function H_(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:O_e,o=e,s,a=In(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=bl(t,o);if("not_found"in c)return c;let l=c.focus,u=eG(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>R_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 O_e,R_e,B_=y(()=>{"use strict";L_();q_();YO();tG();$a();as();O_e=3e3,R_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 I_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 rG(t,e,r="."){let n=In(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=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:I_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 vl,G_=y(()=>{"use strict";L_();YO();B_();as();vl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as P_e,existsSync as tR,mkdirSync as C_e,readFileSync as nG}from"node:fs";import{dirname as D_e,join as N_e}from"node:path";function rR(t){return N_e(t,j_e,M_e)}function F_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:ZO(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function iG(t,e){try{let r=F_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=nR(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=rR(t),s=D_e(o);return tR(s)||C_e(s,{recursive:!0}),P_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 d_e,ZB,f_e,L_=y(()=>{"use strict";d_e=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"]),ZB=2e6,f_e="\0"});function Vf(t){for(let i of m_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 KT(t,e,r){let n=t.get(e);n||(n=new Set,t.set(e,n)),n.add(r)}function h_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??[])KT(e,s,o);for(let s of i.modules??[])KT(r,s,o);for(let s of i.acceptance_criteria??[])for(let a of s.test_refs??[]){let c=Vf(a);c&&KT(n,c,o)}}return{dependents:e,moduleOwners:r,testRefCitations:n}}function In(t){let e=WB.get(t);return e||(e=h_e(t),WB.set(t,e)),e}var m_e,WB,as=y(()=>{"use strict";m_e=["derived:","fixture:","script:","self-dogfood:"];WB=new WeakMap});function JT(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=In(t),o=new Map((t.features??[]).map(_=>[_.id,_])),s=[],a,c=g_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=JT(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:YT(i)}}var $a=y(()=>{"use strict";as()});function KB(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=In(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=JT(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=KB(_),x=S-p,w=S>0?x/S:0;f.push(w);let R=d>0?S/d:1,A=x===0&&b>n,O={frontierExhausted:A,coverage:R,marginalYields:[...f],totalKnownDependents:d};if(A)return{slice:_,depthUsed:b,stoppedBy:"exhaustion",analysis:O};if(R>=o)return{slice:_,depthUsed:b,stoppedBy:"coverage",analysis:O};if(f.length>=2&&f[f.length-1]0?g/d:1,marginalYields:[...f],totalKnownDependents:d}}}var z_,XT=y(()=>{"use strict";$a();as();z_={initialDepth:1,maxDepth:10,coverageThreshold:.9,marginYieldThreshold:.05}});function y_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 JB(t,e){let r=new Map(t.features.map(a=>[a.id,a]));if(!r.has(e))return t;let n=y_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 YB=y(()=>{"use strict"});function __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 bl(t,e){let r=__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=JB(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";YB()});import{existsSync as QB,readdirSync as b_e,readFileSync as v_e}from"node:fs";import{join as eR}from"node:path";function tR(t,e=w_e){let r=t.trim().replace(/\s+/g," ");return r.length<=e?r:`${r.slice(0,e-1)}\u2026`}function x_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:tR(`drift detected at gate ${n}`)}}let r=typeof e.worst=="number"?` (worst ${e.worst})`:"";return{detector:"done_attempted",message:tR(`done reverted \u2014 pre-push strict gate red${r}`)}}function XB(t){let e=Date.parse(t.timestamp);return Number.isFinite(e)?e:0}function $_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 tR(n)}function k_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)=>XB(m)-XB(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(-S_e).map(x_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?$_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 QT(t,e){let r=t.match(e);return r&&r[1]?r[1].trim():void 0}function E_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 A_e(t,e,r){let n=QT(t,/_Rolled back at_\s*`([^`]+)`/),i=QT(t,/Last failed gate:\s*`([^`]+)`/),o=QT(t,/Retry attempts:\s*(\d+)/),s=E_e(t);return{featureId:e,timestamp:n??r,...i?{lastFailedGate:i}:{},...o?{retryCount:Number(o)}:{},...s?{recovery:s}:{}}}function O_e(t,e){let r=eR(t,".cladding","post-mortems");if(!QB(r))return[];let n=`post-mortem-${e}-`,i=[];for(let o of b_e(r))if(!(!o.startsWith(n)||!o.endsWith(".md")))try{i.push(A_e(v_e(eR(r,o),"utf8"),e,o))}catch{}return i}function eG(t,e){try{let r=N_(t),n=O_e(t,e),i=QB(eR(t,".cladding","events.log.1.jsonl"));return k_e(r,n,e,{truncated:i})}catch{return}}var S_e,w_e,tG=y(()=>{"use strict";Fr();S_e=5,w_e=120});function H_(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:T_e,o=e,s,a=In(t).moduleOwners.get(e);if(a&&a.size>0){let se=[...a].sort();o=se[0],se.length>1&&(s=se)}let c=bl(t,o);if("not_found"in c)return c;let l=c.focus,u=eG(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>R_e&&H_(w,R,[])>i;)R.pop();R.lengthi){x.push(`code: omitted ${se} (budget)`);continue}O.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:O},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:O},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 T_e,R_e,B_=y(()=>{"use strict";L_();q_();XT();tG();$a();as();T_e=3e3,R_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 I_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 rG(t,e,r="."){let n=In(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=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:I_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 vl,G_=y(()=>{"use strict";L_();XT();B_();as();vl="(deterministic upper bound vs the shard+all-modules baseline \u2014 not an agent-adoption measurement)"});import{appendFileSync as P_e,existsSync as rR,mkdirSync as C_e,readFileSync as nG}from"node:fs";import{dirname as D_e,join as N_e}from"node:path";function nR(t){return N_e(t,j_e,M_e)}function F_e(t,e){return{timestamp:new Date().toISOString(),head:xa(t),spec_digest:VT(t),featureCount:e.featureCount,measured:e.measured,context:e.context,search:e.search,stability:e.stability}}function iG(t,e){try{let r=F_e(t,e);if(r.head===null)return{appended:!1,reason:"no_head"};let n=iR(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=nR(t),s=D_e(o);return rR(s)||C_e(s,{recursive:!0}),P_e(o,`${JSON.stringify(r)} `,"utf8"),{appended:!0,reason:"appended"}}catch{return{appended:!1,reason:"error"}}}function oG(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 nR(t,e){let r=rR(t);if(!tR(r))return[];let n;try{n=nG(r,"utf8")}catch{return[]}let i=oG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function sG(t){let e=rR(t);if(!tR(e))return{snapshots:[],unreadable:!1};let r;try{r=nG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=oG(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 aG(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(` ${vl}`),i.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 iR(t,e){let r=nR(t);if(!rR(r))return[];let n;try{n=nG(r,"utf8")}catch{return[]}let i=oG(n);return typeof e=="number"&&e>=0?i.slice(-e):i}function sG(t){let e=nR(t);if(!rR(e))return{snapshots:[],unreadable:!1};let r;try{r=nG(e,"utf8")}catch{return{snapshots:[],unreadable:!0}}let n=oG(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 aG(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(` ${vl}`),i.join(` `)}var j_e,M_e,Kf=y(()=>{"use strict";Zf();G_();j_e=".cladding",M_e="measure.jsonl"});import{existsSync as L_e}from"node:fs";import{join as z_e}from"node:path";function Sl(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}** (${U_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 lG(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 ${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`,"",vl),r.join(` `)}function wl(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"} | ${H_e(l,r)} |`)}return n.join(` `)}function H_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 q_e)if(n.startsWith(o))return`${n} (${s})`;let i=n.split("#",1)[0]??n;return`${L_e(z_e(e,i))?"\u2713":"\u2717"} ${n}`}).join("
")}function xl(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),cG(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)cG(e,s)}for(;e[e.length-1]==="";)e.pop();return e.join(` -`)}function cG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=zO(r);n&&t.push(`- ${n}`)}t.push("")}var U_e,q_e,Z_=y(()=>{"use strict";Kf();G_();_l();U_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};q_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 B_e}from"node:fs";function Ri(t="./spec.yaml"){let e=B_e(t,"utf8");return(0,uG.parse)(e)}var uG,V_=y(()=>{"use strict";uG=wt(tr(),1)});var cs=v((Lr,aR)=>{"use strict";var iR=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+fG(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()};iR.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 iR(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 iR(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};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 G_e(t,e){return e+": "+t.toString()+` -`}W_.prototype.toString=function(e){return this.errors.map(G_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});aR.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 dG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};dG.prototype=Object.create(Error.prototype,{constructor:{value:dG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var oR=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+fG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};oR.prototype.resolve=function(e){return pG(this.base,e)};oR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=pG(this.base,i||"");var s=new oR(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 fG=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 Z_e(t,e,r,n){typeof r=="object"?e[n]=sR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function V_e(t,e,r){e[r]=t[r]}function W_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=sR(t[n],e[n]):r[n]=e[n]}function sR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Z_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(V_e.bind(null,t,n)),Object.keys(e).forEach(W_e.bind(null,t,e,n))),n}aR.exports.deepMerge=sR;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 K_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(K_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 pG=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 yG=v((yet,gG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,cR={};cR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=cR.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 lR(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(lR.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(lR.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=lR.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 uR(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(uR(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=uR(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 mG(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&&mG.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)mG.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 dR=cs();fR.exports.SchemaScanResult=_G;function _G(t,e){this.id=t,this.ref=e}fR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=dR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=dR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!dR.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 bG=yG(),us=cs(),vG=K_().scan,SG=us.ValidatorResult,Y_e=us.ValidatorResultError,Jf=us.SchemaError,wG=us.SchemaContext,X_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(bG.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=vG(r||X_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)};$G.exports=Yt});var EG=v((vet,yo)=>{"use strict";var Q_e=yo.exports.Validator=kG();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 Q_e;return n.validate(t,e,r)}});import{readFileSync as ebe}from"node:fs";import{dirname as tbe,join as rbe}from"node:path";import{fileURLToPath as nbe}from"node:url";function cbe(t){let e=abe.validate(t,sbe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function TG(t){let e=cbe(t);if(!e.valid)throw new Error(`spec.yaml invalid: +`)}function cG(t,e){t.push(`### ${e.title}`,"");for(let r of e.acceptance_criteria??[]){let n=UT(r);n&&t.push(`- ${n}`)}t.push("")}var U_e,q_e,Z_=y(()=>{"use strict";Kf();G_();_l();U_e={"added-as-done":"new","flipped-to-done":"completed","modified-while-done":"updated",archived:"retired"};q_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 B_e}from"node:fs";function Ri(t="./spec.yaml"){let e=B_e(t,"utf8");return(0,uG.parse)(e)}var uG,V_=y(()=>{"use strict";uG=wt(tr(),1)});var cs=v((Lr,cR)=>{"use strict";var oR=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+fG(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()};oR.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 oR(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 oR(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};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 G_e(t,e){return e+": "+t.toString()+` +`}W_.prototype.toString=function(e){return this.errors.map(G_e).join("")};Object.defineProperty(W_.prototype,"valid",{get:function(){return!this.errors.length}});cR.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 dG=Lr.SchemaError=function t(e,r){this.message=e,this.schema=r,Error.call(this,e),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,t)};dG.prototype=Object.create(Error.prototype,{constructor:{value:dG,enumerable:!1},name:{value:"SchemaError",enumerable:!1}});var sR=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+fG(a)},"instance")):this.propertyPath=n,this.base=i,this.schemas=o};sR.prototype.resolve=function(e){return pG(this.base,e)};sR.prototype.makeChild=function(e,r){var n=r===void 0?this.path:this.path.concat([r]),i=e.$id||e.id;let o=pG(this.base,i||"");var s=new sR(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 fG=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 Z_e(t,e,r,n){typeof r=="object"?e[n]=aR(t[n],r):t.indexOf(r)===-1&&e.push(r)}function V_e(t,e,r){e[r]=t[r]}function W_e(t,e,r,n){typeof e[n]!="object"||!e[n]?r[n]=e[n]:t[n]?r[n]=aR(t[n],e[n]):r[n]=e[n]}function aR(t,e){var r=Array.isArray(e),n=r&&[]||{};return r?(t=t||[],n=n.concat(t),e.forEach(Z_e.bind(null,t,n))):(t&&typeof t=="object"&&Object.keys(t).forEach(V_e.bind(null,t,n)),Object.keys(e).forEach(W_e.bind(null,t,e,n))),n}cR.exports.deepMerge=aR;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 K_e(t){return"/"+encodeURIComponent(t).replace(/~/g,"%7E")}Lr.encodePath=function(e){return e.map(K_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 pG=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 yG=v((xet,gG)=>{"use strict";var sn=cs(),Le=sn.ValidatorResult,ls=sn.SchemaError,lR={};lR.ignoreProperties={id:!0,default:!0,description:!0,title:!0,additionalItems:!0,then:!0,else:!0,$schema:!0,$ref:!0,extends:!0};var ze=lR.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 uR(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(uR.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(uR.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=uR.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 dR(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(dR(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=dR(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 mG(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&&mG.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)mG.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 fR=cs();pR.exports.SchemaScanResult=_G;function _G(t,e){this.id=t,this.ref=e}pR.exports.scan=function(e,r){function n(c,l){if(!l||typeof l!="object")return;if(l.$ref){let p=fR.resolveUrl(c,l.$ref);a[p]=a[p]?a[p]+1:0;return}var u=l.$id||l.id;let d=fR.resolveUrl(c,u);var f=u?d:c;if(f){if(f.indexOf("#")<0&&(f+="#"),s[f]){if(!fR.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 bG=yG(),us=cs(),vG=K_().scan,SG=us.ValidatorResult,Y_e=us.ValidatorResultError,Jf=us.SchemaError,wG=us.SchemaContext,X_e="/",Yt=function t(){this.customFormats=Object.create(t.prototype.customFormats),this.schemas={},this.unresolvedRefs=[],this.types=Object.create(Ii),this.attributes=Object.create(bG.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=vG(r||X_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)};$G.exports=Yt});var EG=v((Eet,yo)=>{"use strict";var Q_e=yo.exports.Validator=kG();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 Q_e;return n.validate(t,e,r)}});import{readFileSync as ebe}from"node:fs";import{dirname as tbe,join as rbe}from"node:path";import{fileURLToPath as nbe}from"node:url";function cbe(t){let e=abe.validate(t,sbe);return e.valid?{valid:!0,errors:[]}:{valid:!1,errors:e.errors.map(n=>`${n.property}: ${n.message}`)}}function OG(t){let e=cbe(t);if(!e.valid)throw new Error(`spec.yaml invalid: ${e.errors.join(` - `)}`)}var AG,ibe,obe,sbe,abe,OG=y(()=>{"use strict";AG=wt(EG(),1),ibe=tbe(nbe(import.meta.url)),obe=rbe(ibe,"schema.json"),sbe=JSON.parse(ebe(obe,"utf8")),abe=new AG.Validator});import{existsSync as pR,readdirSync as lbe}from"node:fs";import{dirname as ube,join as Aa,resolve as IG}from"node:path";function RG(t){return pR(t)?lbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Ta(t,e){J_=e?{cwd:IG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&IG(t)===J_.cwd?J_.spec:dbe(t,e)}function dbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,ube(e),"spec");if(!n.features||n.features.length===0){let o=RG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=RG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");pR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(pR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return TG(n),n}var J_,Ue=y(()=>{"use strict";V_();OG();J_=null});import $l from"node:process";function gR(){return!!$l.stdout.isTTY}function L(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";gR()?$l.stdout.write(`${mR[t]}${n}${hR} ${e}${i} + `)}`)}var AG,ibe,obe,sbe,abe,TG=y(()=>{"use strict";AG=wt(EG(),1),ibe=tbe(nbe(import.meta.url)),obe=rbe(ibe,"schema.json"),sbe=JSON.parse(ebe(obe,"utf8")),abe=new AG.Validator});import{existsSync as mR,readdirSync as lbe}from"node:fs";import{dirname as ube,join as Aa,resolve as IG}from"node:path";function RG(t){return mR(t)?lbe(t).filter(r=>r.endsWith(".yaml")||r.endsWith(".yml")).map(r=>Ri(Aa(t,r))):[]}function Oa(t,e){J_=e?{cwd:IG(t),spec:e}:null}function q(t=".",e="spec.yaml"){return J_&&e==="spec.yaml"&&IG(t)===J_.cwd?J_.spec:dbe(t,e)}function dbe(t,e){let r=Aa(t,e),n=Ri(r),i=Aa(t,ube(e),"spec");if(!n.features||n.features.length===0){let o=RG(Aa(i,"features"));o.length>0&&(n.features=o)}if(!n.scenarios||n.scenarios.length===0){let o=RG(Aa(i,"scenarios"));o.length>0&&(n.scenarios=o)}if(!n.architecture){let o=Aa(i,"architecture.yaml");mR(o)&&(n.architecture=Ri(o))}if(!n.capabilities||n.capabilities.length===0){let o=Aa(i,"capabilities.yaml");if(mR(o)){let s=Ri(o);s&&Array.isArray(s.capabilities)&&(n.capabilities=s.capabilities)}}return OG(n),n}var J_,Ue=y(()=>{"use strict";V_();TG();J_=null});import $l from"node:process";function yR(){return!!$l.stdout.isTTY}function L(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";yR()?$l.stdout.write(`${hR[t]}${n}${gR} ${e}${i} `):$l.stdout.write(`${n} ${e}${i} -`)}function Yf(t,e,r=""){if(!gR())return;let n=r?` ${r}`:"";$l.stdout.write(`${CG}${mR.start}\xB7${hR} ${t} \xB7 ${e}${n}`)}function Oa(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";gR()?$l.stdout.write(`${CG}${mR[t]}${n}${hR} ${e}${i} +`)}function Yf(t,e,r=""){if(!yR())return;let n=r?` ${r}`:"";$l.stdout.write(`${CG}${hR.start}\xB7${gR} ${t} \xB7 ${e}${n}`)}function Ta(t,e,r=""){let n=PG[t],i=r?` ${r}`:"";yR()?$l.stdout.write(`${CG}${hR[t]}${n}${gR} ${e}${i} `):$l.stdout.write(`${n} ${e}${i} -`)}var PG,mR,hR,CG,Pi=y(()=>{"use strict";PG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},mR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},hR="\x1B[0m",CG="\r\x1B[K"});import{createHash as bR}from"node:crypto";import{existsSync as Kbe,readFileSync as vR,writeFileSync as Jbe}from"node:fs";import{join as Y_}from"node:path";function oZ(t){let e=bR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} -`)}),e.digest("hex")}function Ybe(t,e){let r=bR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(vR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function sZ(t,e){let r=bR("sha256");try{r.update(vR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...iZ);if(!Kbe(e))return null;let r;try{r=vR(e,"utf8")}catch{return null}let n=null,i=null,o=null,s={},a="other";for(let l of r.split(` +`)}var PG,hR,gR,CG,Pi=y(()=>{"use strict";PG={start:"\xB7",pass:"\u2713",fail:"\u2717",skip:"\xB7",note:"\u2139"},hR={start:"\x1B[90m",pass:"\x1B[32m",fail:"\x1B[31m",skip:"\x1B[90m",note:"\x1B[36m"},gR="\x1B[0m",CG="\r\x1B[K"});import{createHash as vR}from"node:crypto";import{existsSync as Kbe,readFileSync as SR,writeFileSync as Jbe}from"node:fs";import{join as Y_}from"node:path";function oZ(t){let e=vR("sha256");return t.forEach((r,n)=>{e.update(`${n}\0${r.name}\0${r.subprocess===!0?"subprocess":"pure"} +`)}),e.digest("hex")}function Ybe(t,e){let r=vR("sha256");for(let n of[...e].sort()){r.update(n),r.update("\0");try{r.update(SR(Y_(t,n)))}catch{r.update("")}r.update("\0")}return r.digest("hex").slice(0,16)}function sZ(t,e){let r=vR("sha256");try{r.update(SR(Y_(t,e)))}catch{r.update("")}return r.digest("hex").slice(0,16)}function ds(t){let e=Y_(t,...iZ);if(!Kbe(e))return null;let r;try{r=SR(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)!==sZ(e,s))return{state:"stale",module:s};return{state:"fresh"}}let i=t.v1?.get(r.id);return i===void 0?{state:"unattested"}:i===Ybe(e,n)?{state:"fresh"}:{state:"stale"}}function aZ(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}: ${sZ(t,c)}`),s=n.map(c=>` ${c.id}: ok`).sort(),a=Xbe+(r?`policy: cladding: ${JSON.stringify(r.cladding)} blocking: ${r.blocking} @@ -219,20 +219,20 @@ 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 SR}from"node:path";function eb(t){fs={cwd:SR(t),results:new Map}}function cZ(t,e,r){!fs||fs.cwd!==SR(e)||fs.results.set(t,r)}function tb(t,e){return!fs||fs.cwd!==SR(e)?null:fs.results.get(t)??null}function rb(){fs=null}var fs,Al=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 Qbe}from"node:url";var Tl,eve,wR,xR,Ol=y(()=>{Tl=(t,e)=>{let r=xR(eve(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},eve=t=>wR(t)?t.toString():t,wR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,xR=t=>t instanceof URL?Qbe(t):t});var nb,$R=y(()=>{bo();Ol();nb=(t,e=[],r={})=>{let n=Tl(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 tve}from"node:string_decoder";var lZ,uZ,qt,vo,rve,dZ,nve,ib,fZ,ive,Qf,ove,kR,sve,an=y(()=>{({toString:lZ}=Object.prototype),uZ=t=>lZ.call(t)==="[object ArrayBuffer]",qt=t=>lZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rve=new TextEncoder,dZ=t=>rve.encode(t),nve=new TextDecoder,ib=t=>nve.decode(t),fZ=(t,e)=>ive(t,e).join(""),ive=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new tve(e),n=t.map(o=>typeof o=="string"?dZ(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]:kR(ove(t)),ove=t=>t.map(e=>typeof e=="string"?dZ(e):e),kR=t=>{let e=new Uint8Array(sve(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},sve=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as ave}from"node:child_process";var gZ,yZ,cve,lve,pZ,uve,mZ,hZ,dve,_Z=y(()=>{bo();an();gZ=t=>Array.isArray(t)&&Array.isArray(t.raw),yZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=cve({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,{}]},cve=({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}=lve(i,t.raw[n]),c=mZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>hZ(d)):[hZ(l)];return mZ(c,u,a)},lve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=pZ.has(e[0]);for(let s=0,a=0;s{"use strict";fs=null});function Tt(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 Qbe}from"node:url";var Ol,eve,xR,$R,Tl=y(()=>{Ol=(t,e)=>{let r=$R(eve(t));if(typeof r!="string")throw new TypeError(`${e} must be a string or a file URL: ${r}.`);return r},eve=t=>xR(t)?t.toString():t,xR=t=>typeof t!="string"&&t&&Object.getPrototypeOf(t)===String.prototype,$R=t=>t instanceof URL?Qbe(t):t});var nb,kR=y(()=>{bo();Tl();nb=(t,e=[],r={})=>{let n=Ol(t,"First argument"),[i,o]=Tt(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(!Tt(o))throw new TypeError(`Last argument must be an options object: ${o}`);return[n,s,o]}});import{StringDecoder as tve}from"node:string_decoder";var lZ,uZ,qt,vo,rve,dZ,nve,ib,fZ,ive,Qf,ove,ER,sve,an=y(()=>{({toString:lZ}=Object.prototype),uZ=t=>lZ.call(t)==="[object ArrayBuffer]",qt=t=>lZ.call(t)==="[object Uint8Array]",vo=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rve=new TextEncoder,dZ=t=>rve.encode(t),nve=new TextDecoder,ib=t=>nve.decode(t),fZ=(t,e)=>ive(t,e).join(""),ive=(t,e)=>{if(e==="utf8"&&t.every(o=>typeof o=="string"))return t;let r=new tve(e),n=t.map(o=>typeof o=="string"?dZ(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]:ER(ove(t)),ove=t=>t.map(e=>typeof e=="string"?dZ(e):e),ER=t=>{let e=new Uint8Array(sve(t)),r=0;for(let n of t)e.set(n,r),r+=n.length;return e},sve=t=>{let e=0;for(let r of t)e+=r.length;return e}});import{ChildProcess as ave}from"node:child_process";var gZ,yZ,cve,lve,pZ,uve,mZ,hZ,dve,_Z=y(()=>{bo();an();gZ=t=>Array.isArray(t)&&Array.isArray(t.raw),yZ=(t,e)=>{let r=[];for(let[o,s]of t.entries())r=cve({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,{}]},cve=({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}=lve(i,t.raw[n]),c=mZ(r,o,s);if(n===e.length)return c;let l=e[n],u=Array.isArray(l)?l.map(d=>hZ(d)):[hZ(l)];return mZ(c,u,a)},lve=(t,e)=>{if(e.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let r=[],n=0,i=pZ.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)],hZ=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 dve(t);throw t instanceof ave||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`)},dve=({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 ER from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[ER.stdin,ER.stdout,ER.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as fve}from"node:util";var vZ,AR,pve,mve,hve,gve,bZ,yve,TR,_ve,bve,vve,Sve,OR,wo,xo=y(()=>{bo();So();vZ=t=>{let e={...t};for(let r of OR)e[r]=AR(t,r);return e},AR=(t,e)=>{let r=Array.from({length:pve(t)+1}),n=mve(t[e],r,e);return bve(n,e)},pve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,mve=(t,e,r)=>Ot(t)?hve(t,e,r):e.fill(t),hve=(t,e,r)=>{for(let n of Object.keys(t).sort(gve))for(let i of yve(n,r,e))e[i]=t[n];return e},gve=(t,e)=>bZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,yve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(t);if(n===void 0||n===0)throw new TypeError(`"${e}.${t}" is invalid. +`]),uve={x:3,u:5},mZ=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t.at(-1)}${e[0]}`,...e.slice(1)],hZ=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(Tt(t)&&("stdout"in t||"isMaxBuffer"in t))return dve(t);throw t instanceof ave||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`)},dve=({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 AR from"node:process";var ri,ob,Pn,sb,So=y(()=>{ri=t=>ob.includes(t),ob=[AR.stdin,AR.stdout,AR.stderr],Pn=["stdin","stdout","stderr"],sb=t=>Pn[t]??`stdio[${t}]`});import{debuglog as fve}from"node:util";var vZ,OR,pve,mve,hve,gve,bZ,yve,TR,_ve,bve,vve,Sve,RR,wo,xo=y(()=>{bo();So();vZ=t=>{let e={...t};for(let r of RR)e[r]=OR(t,r);return e},OR=(t,e)=>{let r=Array.from({length:pve(t)+1}),n=mve(t[e],r,e);return bve(n,e)},pve=({stdio:t})=>Array.isArray(t)?Math.max(t.length,Pn.length):Pn.length,mve=(t,e,r)=>Tt(t)?hve(t,e,r):e.fill(t),hve=(t,e,r)=>{for(let n of Object.keys(t).sort(gve))for(let i of yve(n,r,e))e[i]=t[n];return e},gve=(t,e)=>bZ(t)t==="stdout"||t==="stderr"?0:t==="all"?2:1,yve=(t,e,r)=>{if(t==="ipc")return[r.length-1];let n=TR(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]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=_ve.exec(t);if(e!==null)return Number(e[1])},_ve=/^fd(\d+)$/,bve=(t,e)=>t.map(r=>r===void 0?Sve[e]:r),vve=fve("execa").enabled?"full":"none",Sve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:vve,stripFinalNewline:!0},OR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Rl,Il,SZ,RR,wve,ab,cb,ps=y(()=>{xo();Rl=({verbose:t},e)=>RR(t,e)!=="none",Il=({verbose:t},e)=>!["none","short"].includes(RR(t,e)),SZ=({verbose:t},e)=>{let r=RR(t,e);return ab(r)?r:void 0},RR=(t,e)=>e===void 0?wve(t):wo(t,e),wve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as xve}from"node:process";import{stripVTControlCharacters as $ve}from"node:util";var wZ,ep,xZ,kve,Eve,Ave,Tve,Ove,Rve,Ive,lb=y(()=>{wZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Rve(xZ(o))).join(" ");return{command:n,escapedCommand:i}},ep=t=>$ve(t).split(` +Please set the "stdio" option to ensure that file descriptor exists.`);return n==="all"?[1,2]:[n]},TR=t=>{if(t==="all")return t;if(Pn.includes(t))return Pn.indexOf(t);let e=_ve.exec(t);if(e!==null)return Number(e[1])},_ve=/^fd(\d+)$/,bve=(t,e)=>t.map(r=>r===void 0?Sve[e]:r),vve=fve("execa").enabled?"full":"none",Sve={lines:!1,buffer:!0,maxBuffer:1e3*1e3*100,verbose:vve,stripFinalNewline:!0},RR=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],wo=(t,e)=>e==="ipc"?t.at(-1):t[e]});var Rl,Il,SZ,IR,wve,ab,cb,ps=y(()=>{xo();Rl=({verbose:t},e)=>IR(t,e)!=="none",Il=({verbose:t},e)=>!["none","short"].includes(IR(t,e)),SZ=({verbose:t},e)=>{let r=IR(t,e);return ab(r)?r:void 0},IR=(t,e)=>e===void 0?wve(t):wo(t,e),wve=t=>t.find(e=>ab(e))??cb.findLast(e=>t.includes(e)),ab=t=>typeof t=="function",cb=["none","short","full"]});import{platform as xve}from"node:process";import{stripVTControlCharacters as $ve}from"node:util";var wZ,ep,xZ,kve,Eve,Ave,Ove,Tve,Rve,Ive,lb=y(()=>{wZ=(t,e)=>{let r=[t,...e],n=r.join(" "),i=r.map(o=>Rve(xZ(o))).join(" ");return{command:n,escapedCommand:i}},ep=t=>$ve(t).split(` `).map(e=>xZ(e)).join(` -`),xZ=t=>t.replaceAll(Ave,e=>kve(e)),kve=t=>{let e=Tve[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Ove?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Eve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ave=Eve(),Tve={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Ove=65535,Rve=t=>Ive.test(t)?t:xve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Ive=/^[\w./-]+$/});import $Z from"node:process";function IR(){let{env:t}=$Z,{TERM:e,TERM_PROGRAM:r}=t;return $Z.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 kZ=y(()=>{});var EZ,AZ,Pve,Cve,Dve,Nve,jve,ub,Ttt,TZ=y(()=>{kZ();EZ={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"},AZ={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"},Pve={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"},Cve={...EZ,...AZ},Dve={...EZ,...Pve},Nve=IR(),jve=Nve?Cve:Dve,ub=jve,Ttt=Object.entries(AZ)});import Mve from"node:tty";var Fve,ve,Itt,OZ,Ptt,Ctt,Dtt,Ntt,jtt,Mtt,Ftt,Ltt,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,db,Vtt,Wtt,Ktt,Jtt,Ytt,Xtt,Qtt,ert,trt,RZ,rrt,IZ,nrt,irt,ort,srt,art,crt,lrt,urt,drt,frt,prt,PR=y(()=>{Fve=Mve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Fve)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}},Itt=ve(0,0),OZ=ve(1,22),Ptt=ve(2,22),Ctt=ve(3,23),Dtt=ve(4,24),Ntt=ve(53,55),jtt=ve(7,27),Mtt=ve(8,28),Ftt=ve(9,29),Ltt=ve(30,39),ztt=ve(31,39),Utt=ve(32,39),qtt=ve(33,39),Htt=ve(34,39),Btt=ve(35,39),Gtt=ve(36,39),Ztt=ve(37,39),db=ve(90,39),Vtt=ve(40,49),Wtt=ve(41,49),Ktt=ve(42,49),Jtt=ve(43,49),Ytt=ve(44,49),Xtt=ve(45,49),Qtt=ve(46,49),ert=ve(47,49),trt=ve(100,49),RZ=ve(91,39),rrt=ve(92,39),IZ=ve(93,39),nrt=ve(94,39),irt=ve(95,39),ort=ve(96,39),srt=ve(97,39),art=ve(101,49),crt=ve(102,49),lrt=ve(103,49),urt=ve(104,49),drt=ve(105,49),frt=ve(106,49),prt=ve(107,49)});var PZ=y(()=>{PR();PR()});var NZ,zve,fb,CZ,Uve,DZ,qve,jZ=y(()=>{TZ();PZ();NZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=zve(r),c=Uve[t]({failed:o,reject:s,piped:n}),l=qve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},zve=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"),CZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Uve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:CZ,duration:CZ},DZ=t=>t,qve={command:()=>OZ,output:()=>DZ,ipc:()=>DZ,error:({reject:t})=>t?RZ:IZ,duration:()=>db}});var MZ,Hve,Bve,FZ=y(()=>{ps();MZ=(t,e,r)=>{let n=SZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hve(i,o,n)).filter(i=>i!==void 0).map(i=>Bve(i)).join("")},Hve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Bve=t=>t.endsWith(` +`),xZ=t=>t.replaceAll(Ave,e=>kve(e)),kve=t=>{let e=Ove[t];if(e!==void 0)return e;let r=t.codePointAt(0),n=r.toString(16);return r<=Tve?`\\u${n.padStart(4,"0")}`:`\\U${n}`},Eve=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},Ave=Eve(),Ove={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t"},Tve=65535,Rve=t=>Ive.test(t)?t:xve==="win32"?`"${t.replaceAll('"','""')}"`:`'${t.replaceAll("'","'\\''")}'`,Ive=/^[\w./-]+$/});import $Z from"node:process";function PR(){let{env:t}=$Z,{TERM:e,TERM_PROGRAM:r}=t;return $Z.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 kZ=y(()=>{});var EZ,AZ,Pve,Cve,Dve,Nve,jve,ub,Ctt,OZ=y(()=>{kZ();EZ={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"},AZ={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"},Pve={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"},Cve={...EZ,...AZ},Dve={...EZ,...Pve},Nve=PR(),jve=Nve?Cve:Dve,ub=jve,Ctt=Object.entries(AZ)});import Mve from"node:tty";var Fve,ve,jtt,TZ,Mtt,Ftt,Ltt,ztt,Utt,qtt,Htt,Btt,Gtt,Ztt,Vtt,Wtt,Ktt,Jtt,Ytt,db,Xtt,Qtt,ert,trt,rrt,nrt,irt,ort,srt,RZ,art,IZ,crt,lrt,urt,drt,frt,prt,mrt,hrt,grt,yrt,_rt,CR=y(()=>{Fve=Mve?.WriteStream?.prototype?.hasColors?.()??!1,ve=(t,e)=>{if(!Fve)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}},jtt=ve(0,0),TZ=ve(1,22),Mtt=ve(2,22),Ftt=ve(3,23),Ltt=ve(4,24),ztt=ve(53,55),Utt=ve(7,27),qtt=ve(8,28),Htt=ve(9,29),Btt=ve(30,39),Gtt=ve(31,39),Ztt=ve(32,39),Vtt=ve(33,39),Wtt=ve(34,39),Ktt=ve(35,39),Jtt=ve(36,39),Ytt=ve(37,39),db=ve(90,39),Xtt=ve(40,49),Qtt=ve(41,49),ert=ve(42,49),trt=ve(43,49),rrt=ve(44,49),nrt=ve(45,49),irt=ve(46,49),ort=ve(47,49),srt=ve(100,49),RZ=ve(91,39),art=ve(92,39),IZ=ve(93,39),crt=ve(94,39),lrt=ve(95,39),urt=ve(96,39),drt=ve(97,39),frt=ve(101,49),prt=ve(102,49),mrt=ve(103,49),hrt=ve(104,49),grt=ve(105,49),yrt=ve(106,49),_rt=ve(107,49)});var PZ=y(()=>{CR();CR()});var NZ,zve,fb,CZ,Uve,DZ,qve,jZ=y(()=>{OZ();PZ();NZ=({type:t,message:e,timestamp:r,piped:n,commandId:i,result:{failed:o=!1}={},options:{reject:s=!0}})=>{let a=zve(r),c=Uve[t]({failed:o,reject:s,piped:n}),l=qve[t]({reject:s});return`${db(`[${a}]`)} ${db(`[${i}]`)} ${l(c)} ${l(e)}`},zve=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"),CZ=({failed:t,reject:e})=>t?e?ub.cross:ub.warning:ub.tick,Uve={command:({piped:t})=>t?"|":"$",output:()=>" ",ipc:()=>"*",error:CZ,duration:CZ},DZ=t=>t,qve={command:()=>TZ,output:()=>DZ,ipc:()=>DZ,error:({reject:t})=>t?RZ:IZ,duration:()=>db}});var MZ,Hve,Bve,FZ=y(()=>{ps();MZ=(t,e,r)=>{let n=SZ(e,r);return t.map(({verboseLine:i,verboseObject:o})=>Hve(i,o,n)).filter(i=>i!==void 0).map(i=>Bve(i)).join("")},Hve=(t,e,r)=>{if(r===void 0)return t;let n=r(t,e);if(typeof n=="string")return n},Bve=t=>t.endsWith(` `)?t:`${t} `});import{inspect as Gve}from"node:util";var Ci,Zve,Vve,Wve,pb,Kve,Pl=y(()=>{lb();jZ();FZ();Ci=({type:t,verboseMessage:e,fdNumber:r,verboseInfo:n,result:i})=>{let o=Zve({type:t,result:i,verboseInfo:n}),s=Vve(e,o),a=MZ(s,n,r);a!==""&&console.warn(a.slice(0,-1))},Zve=({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}),Vve=(t,e)=>t.split(` -`).map(r=>Wve({...e,message:r})),Wve=t=>({verboseLine:NZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Gve(t);return ep(e).replaceAll(" "," ".repeat(Kve))},Kve=2});var LZ,zZ=y(()=>{ps();Pl();LZ=(t,e)=>{Rl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var UZ,Jve,Yve,Xve,qZ=y(()=>{ps();UZ=(t,e,r)=>{Xve(t);let n=Jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Jve=t=>Rl({verbose:t})?Yve++:void 0,Yve=0n,Xve=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 HZ}from"node:process";var mb,CR,hb=y(()=>{mb=()=>HZ.bigint(),CR=t=>Number(HZ.bigint()-t)/1e6});var gb,DR=y(()=>{zZ();qZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=wZ(t,e),s=AR(r,"verbose"),a=UZ(s,o,{...r});return LZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var WZ=v((Lrt,VZ)=>{VZ.exports=ZZ;ZZ.sync=eSe;var BZ=Ze("fs");function Qve(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{XZ.exports=JZ;JZ.sync=tSe;var KZ=Ze("fs");function JZ(t,e,r){KZ.stat(t,function(n,i){r(n,n?!1:YZ(i,e))})}function tSe(t,e){return YZ(KZ.statSync(t),e)}function YZ(t,e){return t.isFile()&&rSe(t,e)}function rSe(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 tV=v((qrt,eV)=>{var Urt=Ze("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=WZ():yb=QZ();eV.exports=NR;NR.sync=nSe;function NR(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){NR(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 nSe(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var cV=v((Hrt,aV)=>{var Cl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rV=Ze("path"),iSe=Cl?";":":",nV=tV(),iV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),oV=(t,e)=>{let r=e.colon||iSe,n=t.match(/\//)||Cl&&t.match(/\\/)?[""]:[...Cl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Cl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Cl?i.split(r):[""];return Cl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},sV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=oV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(iV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=rV.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];nV(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)},oSe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=oV(t,e),o=[];for(let s=0;s{"use strict";var lV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};jR.exports=lV;jR.exports.default=lV});var mV=v((Grt,pV)=>{"use strict";var dV=Ze("path"),sSe=cV(),aSe=uV();function fV(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=sSe.sync(t.command,{path:r[aSe({env:r})],pathExt:e?dV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=dV.resolve(i?t.options.cwd:"",s)),s}function cSe(t){return fV(t)||fV(t,!0)}pV.exports=cSe});var hV=v((Zrt,FR)=>{"use strict";var MR=/([()\][%!^"`<>&|;, *?])/g;function lSe(t){return t=t.replace(MR,"^$1"),t}function uSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(MR,"^$1"),e&&(t=t.replace(MR,"^$1")),t}FR.exports.command=lSe;FR.exports.argument=uSe});var yV=v((Vrt,gV)=>{"use strict";gV.exports=/^#!(.*)/});var bV=v((Wrt,_V)=>{"use strict";var dSe=yV();_V.exports=(t="")=>{let e=t.match(dSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var SV=v((Krt,vV)=>{"use strict";var LR=Ze("fs"),fSe=bV();function pSe(t){let r=Buffer.alloc(150),n;try{n=LR.openSync(t,"r"),LR.readSync(n,r,0,150,0),LR.closeSync(n)}catch{}return fSe(r.toString())}vV.exports=pSe});var kV=v((Jrt,$V)=>{"use strict";var mSe=Ze("path"),wV=mV(),xV=hV(),hSe=SV(),gSe=process.platform==="win32",ySe=/\.(?:com|exe)$/i,_Se=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bSe(t){t.file=wV(t);let e=t.file&&hSe(t.file);return e?(t.args.unshift(t.file),t.command=e,wV(t)):t.file}function vSe(t){if(!gSe)return t;let e=bSe(t),r=!ySe.test(e);if(t.options.forceShell||r){let n=_Se.test(e);t.command=mSe.normalize(t.command),t.command=xV.command(t.command),t.args=t.args.map(o=>xV.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 SSe(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:vSe(n)}$V.exports=SSe});var TV=v((Yrt,AV)=>{"use strict";var zR=process.platform==="win32";function UR(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 wSe(t,e){if(!zR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=EV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function EV(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawn"):null}function xSe(t,e){return zR&&t===1&&!e.file?UR(e.original,"spawnSync"):null}AV.exports={hookChildProcess:wSe,verifyENOENT:EV,verifyENOENTSync:xSe,notFoundError:UR}});var IV=v((Xrt,Dl)=>{"use strict";var OV=Ze("child_process"),qR=kV(),HR=TV();function RV(t,e,r){let n=qR(t,e,r),i=OV.spawn(n.command,n.args,n.options);return HR.hookChildProcess(i,n),i}function $Se(t,e,r){let n=qR(t,e,r),i=OV.spawnSync(n.command,n.args,n.options);return i.error=i.error||HR.verifyENOENTSync(i.status,n),i}Dl.exports=RV;Dl.exports.spawn=RV;Dl.exports.sync=$Se;Dl.exports._parse=qR;Dl.exports._enoent=HR});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 PV=y(()=>{});var CV=y(()=>{});import{promisify as kSe}from"node:util";import{execFile as ESe,execFileSync as nnt}from"node:child_process";import DV from"node:path";import{fileURLToPath as ASe}from"node:url";function bb(t){return t instanceof URL?ASe(t):t}function NV(t){return{*[Symbol.iterator](){let e=DV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=DV.resolve(e,"..")}}}var snt,ant,jV=y(()=>{CV();snt=kSe(ESe);ant=10*1024*1024});import vb from"node:process";import Ca from"node:path";var TSe,OSe,RSe,MV,FV=y(()=>{PV();jV();TSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&OSe(s,a,o),i&&RSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},OSe=(t,e,r)=>{for(let n of NV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},RSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},MV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=TSe(e),t}});var LV,ni,zV,UV,qV,Sb,tp,rp,Da=y(()=>{LV=(t,e,r)=>{let n=r?rp:tp,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},zV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,qV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},UV=t=>Sb(t)&&qV in t,qV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",tp=class extends Error{};zV(tp,tp.name);rp=class extends Error{};zV(rp,rp.name)});var HV,ISe,BV,GV,ZV=y(()=>{HV=()=>{let t=GV-BV+1;return Array.from({length:t},ISe)},ISe=(t,e)=>({name:`SIGRT${e+1}`,number:BV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BV=34,GV=64});var VV,WV=y(()=>{VV=[{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 PSe}from"node:os";var BR,CSe,KV=y(()=>{WV();ZV();BR=()=>{let t=HV();return[...VV,...t].map(CSe)},CSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=PSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as DSe}from"node:os";var NSe,jSe,JV,MSe,FSe,LSe,$nt,YV=y(()=>{KV();NSe=()=>{let t=BR();return Object.fromEntries(t.map(jSe))},jSe=({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}],JV=NSe(),MSe=()=>{let t=BR(),e=65,r=Array.from({length:e},(n,i)=>FSe(i,t));return Object.assign({},...r)},FSe=(t,e)=>{let r=LSe(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}}},LSe=(t,e)=>{let r=e.find(({name:n})=>DSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},$nt=MSe()});import{constants as np}from"node:os";var QV,e9,t9,zSe,USe,XV,qSe,GR,HSe,BSe,wb,ip=y(()=>{YV();QV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return t9(t,e)},e9=t=>t===0?t:t9(t,"`subprocess.kill()`'s argument"),t9=(t,e)=>{if(Number.isInteger(t))return zSe(t,e);if(typeof t=="string")return qSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. -${GR()}`)},zSe=(t,e)=>{if(XV.has(t))return XV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. -${GR()}`)},USe=()=>new Map(Object.entries(np.signals).reverse().map(([t,e])=>[e,t])),XV=USe(),qSe=(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. -${GR()}`)},GR=()=>`Available signal names: ${HSe()}. -Available signal numbers: ${BSe()}.`,HSe=()=>Object.keys(np.signals).sort().map(t=>`'${t}'`).join(", "),BSe=()=>[...new Set(Object.values(np.signals).sort((t,e)=>t-e))].join(", "),wb=t=>JV[t].description});import{setTimeout as GSe}from"node:timers/promises";var r9,ZSe,n9,VSe,WSe,KSe,ZR,xb=y(()=>{Da();ip();r9=t=>{if(t===!1)return t;if(t===!0)return ZSe;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},ZSe=1e3*5,n9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=VSe(s,a,r);WSe(l,n);let u=t(c);return KSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},VSe=(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:e9(n),error:i}},WSe=(t,e)=>{t!==void 0&&e.reject(t)},KSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&ZR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},ZR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await GSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as JSe}from"node:events";var $b,VR=y(()=>{$b=async(t,e)=>{t.aborted||await JSe(t,"abort",{signal:e})}});var i9,o9,YSe,WR=y(()=>{VR();i9=({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)}`)},o9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[YSe(t,e,n,i)],YSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Nl,XSe,KR,s9,a9,kb,c9,l9,u9,d9,f9,p9,QSe,ewe,twe,ii,rwe,ms,jl,Ml=y(()=>{Nl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{XSe(t,e,r),KR(t,e,n)},XSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},KR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},s9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},a9=t=>{throw new Error(`${ii("sendMessage",t)} failed: the ${ms(t)} is sending a message too, instead of listening to incoming messages. +`).map(r=>Wve({...e,message:r})),Wve=t=>({verboseLine:NZ(t),verboseObject:t}),pb=t=>{let e=typeof t=="string"?t:Gve(t);return ep(e).replaceAll(" "," ".repeat(Kve))},Kve=2});var LZ,zZ=y(()=>{ps();Pl();LZ=(t,e)=>{Rl(e)&&Ci({type:"command",verboseMessage:t,verboseInfo:e})}});var UZ,Jve,Yve,Xve,qZ=y(()=>{ps();UZ=(t,e,r)=>{Xve(t);let n=Jve(t);return{verbose:t,escapedCommand:e,commandId:n,rawOptions:r}},Jve=t=>Rl({verbose:t})?Yve++:void 0,Yve=0n,Xve=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 HZ}from"node:process";var mb,DR,hb=y(()=>{mb=()=>HZ.bigint(),DR=t=>Number(HZ.bigint()-t)/1e6});var gb,NR=y(()=>{zZ();qZ();hb();lb();xo();gb=(t,e,r)=>{let n=mb(),{command:i,escapedCommand:o}=wZ(t,e),s=OR(r,"verbose"),a=UZ(s,o,{...r});return LZ(o,a),{command:i,escapedCommand:o,startTime:n,verboseInfo:a}}});var WZ=v((Brt,VZ)=>{VZ.exports=ZZ;ZZ.sync=eSe;var BZ=Ze("fs");function Qve(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{XZ.exports=JZ;JZ.sync=tSe;var KZ=Ze("fs");function JZ(t,e,r){KZ.stat(t,function(n,i){r(n,n?!1:YZ(i,e))})}function tSe(t,e){return YZ(KZ.statSync(t),e)}function YZ(t,e){return t.isFile()&&rSe(t,e)}function rSe(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 tV=v((Vrt,eV)=>{var Zrt=Ze("fs"),yb;process.platform==="win32"||global.TESTING_WINDOWS?yb=WZ():yb=QZ();eV.exports=jR;jR.sync=nSe;function jR(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){jR(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 nSe(t,e){try{return yb.sync(t,e||{})}catch(r){if(e&&e.ignoreErrors||r.code==="EACCES")return!1;throw r}}});var cV=v((Wrt,aV)=>{var Cl=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",rV=Ze("path"),iSe=Cl?";":":",nV=tV(),iV=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"}),oV=(t,e)=>{let r=e.colon||iSe,n=t.match(/\//)||Cl&&t.match(/\\/)?[""]:[...Cl?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(r)],i=Cl?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=Cl?i.split(r):[""];return Cl&&t.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:n,pathExt:o,pathExtExe:i}},sV=(t,e,r)=>{typeof e=="function"&&(r=e,e={}),e||(e={});let{pathEnv:n,pathExt:i,pathExtExe:o}=oV(t,e),s=[],a=l=>new Promise((u,d)=>{if(l===n.length)return e.all&&s.length?u(s):d(iV(t));let f=n[l],p=/^".*"$/.test(f)?f.slice(1,-1):f,m=rV.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];nV(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)},oSe=(t,e)=>{e=e||{};let{pathEnv:r,pathExt:n,pathExtExe:i}=oV(t,e),o=[];for(let s=0;s{"use strict";var lV=(t={})=>{let e=t.env||process.env;return(t.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(n=>n.toUpperCase()==="PATH")||"Path"};MR.exports=lV;MR.exports.default=lV});var mV=v((Jrt,pV)=>{"use strict";var dV=Ze("path"),sSe=cV(),aSe=uV();function fV(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=sSe.sync(t.command,{path:r[aSe({env:r})],pathExt:e?dV.delimiter:void 0})}catch{}finally{o&&process.chdir(n)}return s&&(s=dV.resolve(i?t.options.cwd:"",s)),s}function cSe(t){return fV(t)||fV(t,!0)}pV.exports=cSe});var hV=v((Yrt,LR)=>{"use strict";var FR=/([()\][%!^"`<>&|;, *?])/g;function lSe(t){return t=t.replace(FR,"^$1"),t}function uSe(t,e){return t=`${t}`,t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),t=t.replace(/(?=(\\+?)?)\1$/,"$1$1"),t=`"${t}"`,t=t.replace(FR,"^$1"),e&&(t=t.replace(FR,"^$1")),t}LR.exports.command=lSe;LR.exports.argument=uSe});var yV=v((Xrt,gV)=>{"use strict";gV.exports=/^#!(.*)/});var bV=v((Qrt,_V)=>{"use strict";var dSe=yV();_V.exports=(t="")=>{let e=t.match(dSe);if(!e)return null;let[r,n]=e[0].replace(/#! ?/,"").split(" "),i=r.split("/").pop();return i==="env"?n:n?`${i} ${n}`:i}});var SV=v((ent,vV)=>{"use strict";var zR=Ze("fs"),fSe=bV();function pSe(t){let r=Buffer.alloc(150),n;try{n=zR.openSync(t,"r"),zR.readSync(n,r,0,150,0),zR.closeSync(n)}catch{}return fSe(r.toString())}vV.exports=pSe});var kV=v((tnt,$V)=>{"use strict";var mSe=Ze("path"),wV=mV(),xV=hV(),hSe=SV(),gSe=process.platform==="win32",ySe=/\.(?:com|exe)$/i,_Se=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function bSe(t){t.file=wV(t);let e=t.file&&hSe(t.file);return e?(t.args.unshift(t.file),t.command=e,wV(t)):t.file}function vSe(t){if(!gSe)return t;let e=bSe(t),r=!ySe.test(e);if(t.options.forceShell||r){let n=_Se.test(e);t.command=mSe.normalize(t.command),t.command=xV.command(t.command),t.args=t.args.map(o=>xV.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 SSe(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:vSe(n)}$V.exports=SSe});var OV=v((rnt,AV)=>{"use strict";var UR=process.platform==="win32";function qR(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 wSe(t,e){if(!UR)return;let r=t.emit;t.emit=function(n,i){if(n==="exit"){let o=EV(i,e);if(o)return r.call(t,"error",o)}return r.apply(t,arguments)}}function EV(t,e){return UR&&t===1&&!e.file?qR(e.original,"spawn"):null}function xSe(t,e){return UR&&t===1&&!e.file?qR(e.original,"spawnSync"):null}AV.exports={hookChildProcess:wSe,verifyENOENT:EV,verifyENOENTSync:xSe,notFoundError:qR}});var IV=v((nnt,Dl)=>{"use strict";var TV=Ze("child_process"),HR=kV(),BR=OV();function RV(t,e,r){let n=HR(t,e,r),i=TV.spawn(n.command,n.args,n.options);return BR.hookChildProcess(i,n),i}function $Se(t,e,r){let n=HR(t,e,r),i=TV.spawnSync(n.command,n.args,n.options);return i.error=i.error||BR.verifyENOENTSync(i.status,n),i}Dl.exports=RV;Dl.exports.spawn=RV;Dl.exports.sync=$Se;Dl.exports._parse=HR;Dl.exports._enoent=BR});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 PV=y(()=>{});var CV=y(()=>{});import{promisify as kSe}from"node:util";import{execFile as ESe,execFileSync as cnt}from"node:child_process";import DV from"node:path";import{fileURLToPath as ASe}from"node:url";function bb(t){return t instanceof URL?ASe(t):t}function NV(t){return{*[Symbol.iterator](){let e=DV.resolve(bb(t)),r;for(;r!==e;)yield e,r=e,e=DV.resolve(e,"..")}}}var dnt,fnt,jV=y(()=>{CV();dnt=kSe(ESe);fnt=10*1024*1024});import vb from"node:process";import Ca from"node:path";var OSe,TSe,RSe,MV,FV=y(()=>{PV();jV();OSe=({cwd:t=vb.cwd(),path:e=vb.env[_b()],preferLocal:r=!0,execPath:n=vb.execPath,addExecPath:i=!0}={})=>{let o=Ca.resolve(bb(t)),s=[],a=e.split(Ca.delimiter);return r&&TSe(s,a,o),i&&RSe(s,a,n,o),e===""||e===Ca.delimiter?`${s.join(Ca.delimiter)}${e}`:[...s,e].join(Ca.delimiter)},TSe=(t,e,r)=>{for(let n of NV(r)){let i=Ca.join(n,"node_modules/.bin");e.includes(i)||t.push(i)}},RSe=(t,e,r,n)=>{let i=Ca.resolve(n,bb(r),"..");e.includes(i)||t.push(i)},MV=({env:t=vb.env,...e}={})=>{t={...t};let r=_b({env:t});return e.path=t[r],t[r]=OSe(e),t}});var LV,ni,zV,UV,qV,Sb,tp,rp,Da=y(()=>{LV=(t,e,r)=>{let n=r?rp:tp,i=t instanceof ni?{}:{cause:t};return new n(e,i)},ni=class extends Error{},zV=(t,e)=>{Object.defineProperty(t.prototype,"name",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,qV,{value:!0,writable:!1,enumerable:!1,configurable:!1})},UV=t=>Sb(t)&&qV in t,qV=Symbol("isExecaError"),Sb=t=>Object.prototype.toString.call(t)==="[object Error]",tp=class extends Error{};zV(tp,tp.name);rp=class extends Error{};zV(rp,rp.name)});var HV,ISe,BV,GV,ZV=y(()=>{HV=()=>{let t=GV-BV+1;return Array.from({length:t},ISe)},ISe=(t,e)=>({name:`SIGRT${e+1}`,number:BV+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),BV=34,GV=64});var VV,WV=y(()=>{VV=[{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 PSe}from"node:os";var GR,CSe,KV=y(()=>{WV();ZV();GR=()=>{let t=HV();return[...VV,...t].map(CSe)},CSe=({name:t,number:e,description:r,action:n,forced:i=!1,standard:o})=>{let{signals:{[t]:s}}=PSe,a=s!==void 0;return{name:t,number:a?s:e,description:r,supported:a,action:n,forced:i,standard:o}}});import{constants as DSe}from"node:os";var NSe,jSe,JV,MSe,FSe,LSe,Tnt,YV=y(()=>{KV();NSe=()=>{let t=GR();return Object.fromEntries(t.map(jSe))},jSe=({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}],JV=NSe(),MSe=()=>{let t=GR(),e=65,r=Array.from({length:e},(n,i)=>FSe(i,t));return Object.assign({},...r)},FSe=(t,e)=>{let r=LSe(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}}},LSe=(t,e)=>{let r=e.find(({name:n})=>DSe.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},Tnt=MSe()});import{constants as np}from"node:os";var QV,e9,t9,zSe,USe,XV,qSe,ZR,HSe,BSe,wb,ip=y(()=>{YV();QV=t=>{let e="option `killSignal`";if(t===0)throw new TypeError(`Invalid ${e}: 0 cannot be used.`);return t9(t,e)},e9=t=>t===0?t:t9(t,"`subprocess.kill()`'s argument"),t9=(t,e)=>{if(Number.isInteger(t))return zSe(t,e);if(typeof t=="string")return qSe(t,e);throw new TypeError(`Invalid ${e} ${String(t)}: it must be a string or an integer. +${ZR()}`)},zSe=(t,e)=>{if(XV.has(t))return XV.get(t);throw new TypeError(`Invalid ${e} ${t}: this signal integer does not exist. +${ZR()}`)},USe=()=>new Map(Object.entries(np.signals).reverse().map(([t,e])=>[e,t])),XV=USe(),qSe=(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. +${ZR()}`)},ZR=()=>`Available signal names: ${HSe()}. +Available signal numbers: ${BSe()}.`,HSe=()=>Object.keys(np.signals).sort().map(t=>`'${t}'`).join(", "),BSe=()=>[...new Set(Object.values(np.signals).sort((t,e)=>t-e))].join(", "),wb=t=>JV[t].description});import{setTimeout as GSe}from"node:timers/promises";var r9,ZSe,n9,VSe,WSe,KSe,VR,xb=y(()=>{Da();ip();r9=t=>{if(t===!1)return t;if(t===!0)return ZSe;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},ZSe=1e3*5,n9=({kill:t,options:{forceKillAfterDelay:e,killSignal:r},onInternalError:n,context:i,controller:o},s,a)=>{let{signal:c,error:l}=VSe(s,a,r);WSe(l,n);let u=t(c);return KSe({kill:t,signal:c,forceKillAfterDelay:e,killSignal:r,killResult:u,context:i,controller:o}),u},VSe=(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:e9(n),error:i}},WSe=(t,e)=>{t!==void 0&&e.reject(t)},KSe=async({kill:t,signal:e,forceKillAfterDelay:r,killSignal:n,killResult:i,context:o,controller:s})=>{e===n&&i&&VR({kill:t,forceKillAfterDelay:r,context:o,controllerSignal:s.signal})},VR=async({kill:t,forceKillAfterDelay:e,context:r,controllerSignal:n})=>{if(e!==!1)try{await GSe(e,void 0,{signal:n}),t("SIGKILL")&&(r.isForcefullyTerminated??=!0)}catch{}}});import{once as JSe}from"node:events";var $b,WR=y(()=>{$b=async(t,e)=>{t.aborted||await JSe(t,"abort",{signal:e})}});var i9,o9,YSe,KR=y(()=>{WR();i9=({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)}`)},o9=({subprocess:t,cancelSignal:e,gracefulCancel:r,context:n,controller:i})=>e===void 0||r?[]:[YSe(t,e,n,i)],YSe=async(t,e,r,{signal:n})=>{throw await $b(e,n),r.terminationReason??="cancel",t.kill(),e.reason}});var Nl,XSe,JR,s9,a9,kb,c9,l9,u9,d9,f9,p9,QSe,ewe,twe,ii,rwe,ms,jl,Ml=y(()=>{Nl=({methodName:t,isSubprocess:e,ipc:r,isConnected:n})=>{XSe(t,e,r),JR(t,e,n)},XSe=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} can only be used if the \`ipc\` option is \`true\`.`)},JR=(t,e,r)=>{if(!r)throw new Error(`${ii(t,e)} cannot be used: the ${ms(e)} has already exited or disconnected.`)},s9=t=>{throw new Error(`${ii("getOneMessage",t)} could not complete: the ${ms(t)} exited or disconnected.`)},a9=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([ @@ -242,32 +242,32 @@ const [receivedMessage] = await Promise.all([ It must be ${n} or "fd3", "fd4" (and so on). It is optional and defaults to "${i}".`)},iwe=(t,e,r,n)=>{let i=n[g9(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.`)},h9=(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}=owe(t,r);return`The "${i}: ${Eb(o)}" option is incompatible with using "${op(n)}: ${Eb(e)}". -Please set this option with "pipe" instead.`},owe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=g9(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]}},g9=t=>t==="all"?1:t,op=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as swe}from"node:events";var Na,Tb=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),swe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Ob,JR,Rb,YR,y9,_9,sp=y(()=>{Ob=(t,e)=>{e&&JR(t)},JR=t=>{t.refCounted()},Rb=(t,e)=>{e&&YR(t)},YR=t=>{t.unrefCounted()},y9=(t,e)=>{e&&(YR(t),YR(t))},_9=(t,e)=>{e&&(JR(t),JR(t))}});import{once as awe}from"node:events";import{scheduler as cwe}from"node:timers/promises";var b9,v9,Ib,S9=y(()=>{Cb();sp();Pb();Db();b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(x9(i)||k9(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 $9(t,n,i),await cwe.yield();let s=await w9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{XR();let o=Ib.get(t);for(;o?.length>0;)await awe(n,"message:done");t.removeListener("message",i),_9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as lwe}from"node:events";var gs,Nb,uwe,jb,ap=y(()=>{S9();sp();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new lwe;return n.connected=!0,Nb.set(t,n),uwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,uwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),y9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dwe}from"node:events";var E9,fwe,A9,w9,x9,T9,Mb,pwe,Fb,O9,Pb=y(()=>{Fl();Tb();Ub();Ml();ap();Cb();E9=({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:fwe++,type:Fb,message:n,hasListeners:s}},fwe=0n,A9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},w9=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:O9,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},x9=t=>{if(t?.type!==O9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},T9=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,pwe(e,r,i)]);o&&a9(r),s||c9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},pwe=async(t,e,{signal:r})=>{Na(t,1,r),await dwe(t,"disconnect",{signal:r}),l9(e)},Fb="execa:ipc:request",O9="execa:ipc:response"});var R9,I9,$9,cp,Lb,mwe,Cb=y(()=>{Fl();xo();hs();Pb();R9=(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}},I9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},$9=async(t,e,r)=>{for(;!Lb(t,e)&&cp.get(t)?.size>0;){let n=[...cp.get(t)];A9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},cp=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>mwe(t),mwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as hwe}from"node:util";var zb,gwe,eI,ywe,QR,Ub=y(()=>{Ml();Cb();Pb();zb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Nl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=E9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=R9(t,s,o);try{await eI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw jl(t),c}finally{I9(a)}},eI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ywe(t);try{await Promise.all([T9(n,t,r),o(n)])}catch(s){throw f9({error:s,methodName:e,isSubprocess:r}),p9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ywe=t=>{if(QR.has(t))return QR.get(t);let e=hwe(t.send.bind(t));return QR.set(t,e),e},QR=new WeakMap});import{scheduler as _we}from"node:timers/promises";var C9,D9,bwe,P9,k9,N9,XR,tI,Db=y(()=>{Ub();ap();Ml();C9=(t,e)=>{let r="cancelSignal";return KR(r,!1,t.connected),eI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:N9,message:e},message:e})},D9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),tI.signal),bwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!P9){if(P9=!0,!n){d9();return}if(e===null){XR();return}gs(t,e,r),await _we.yield()}},P9=!1,k9=t=>t?.type!==N9?!1:(tI.abort(t.message),!0),N9="execa:ipc:cancel",XR=()=>{tI.abort(u9())},tI=new AbortController});var j9,M9,vwe,Swe,rI=y(()=>{VR();Db();xb();j9=({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.")}},M9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=Swe(e);throw await C9(t,o),ZR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Swe=({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 wwe}from"node:timers/promises";var F9,L9,xwe,nI=y(()=>{Da();F9=({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})`)},L9=(t,e,r,n)=>e===0||e===void 0?[]:[xwe(t,e,r,n)],xwe=async(t,e,r,{signal:n})=>{throw await wwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as $we,execArgv as kwe}from"node:process";import z9 from"node:path";var U9,q9,iI=y(()=>{Ol();U9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},q9=(t,e,{node:r=!1,nodePath:n=$we,nodeOptions:i=kwe.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=Tl(n,'The "nodePath" option'),l=z9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(z9.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 Ewe}from"node:v8";var H9,Awe,Twe,Owe,B9,oI=y(()=>{H9=({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`.");Owe[r](t)}},Awe=t=>{try{Ewe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Twe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Owe={advanced:Awe,json:Twe},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var Z9,Rwe,cn,sI,Iwe,G9,qb,ja=y(()=>{Z9=({encoding:t})=>{if(sI.has(t))return;let e=Iwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to ${qb(e)}.`);let r=[...sI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. -Please rename it to one of: ${r}.`)},Rwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),sI=new Set([...Rwe,...cn]),Iwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in G9)return G9[e];if(sI.has(e))return e},G9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pwe}from"node:fs";import Cwe from"node:path";import Dwe from"node:process";var V9,W9,K9,aI=y(()=>{Ol();V9=(t=W9())=>{let e=Tl(t,'The "cwd" option');return Cwe.resolve(e)},W9=()=>{try{return Dwe.cwd()}catch(t){throw t.message=`The current directory does not exist. +Please set this option with "pipe" instead.`},owe=(t,{stdin:e,stdout:r,stderr:n,stdio:i})=>{let o=g9(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]}},g9=t=>t==="all"?1:t,op=t=>t?"to":"from",Eb=t=>typeof t=="string"?`'${t}'`:typeof t=="number"?`${t}`:"Stream"});import{addAbortListener as swe}from"node:events";var Na,Ob=y(()=>{Na=(t,e,r)=>{let n=t.getMaxListeners();n===0||n===Number.POSITIVE_INFINITY||(t.setMaxListeners(n+e),swe(r,()=>{t.setMaxListeners(t.getMaxListeners()-e)}))}});var Tb,YR,Rb,XR,y9,_9,sp=y(()=>{Tb=(t,e)=>{e&&YR(t)},YR=t=>{t.refCounted()},Rb=(t,e)=>{e&&XR(t)},XR=t=>{t.unrefCounted()},y9=(t,e)=>{e&&(XR(t),XR(t))},_9=(t,e)=>{e&&(YR(t),YR(t))}});import{once as awe}from"node:events";import{scheduler as cwe}from"node:timers/promises";var b9,v9,Ib,S9=y(()=>{Cb();sp();Pb();Db();b9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n},i)=>{if(x9(i)||k9(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 $9(t,n,i),await cwe.yield();let s=await w9({wrappedMessage:o[0],anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n});o.shift(),n.emit("message",s),n.emit("message:done")}},v9=async({anyProcess:t,channel:e,isSubprocess:r,ipcEmitter:n,boundOnMessage:i})=>{QR();let o=Ib.get(t);for(;o?.length>0;)await awe(n,"message:done");t.removeListener("message",i),_9(e,r),n.connected=!1,n.emit("disconnect")},Ib=new WeakMap});import{EventEmitter as lwe}from"node:events";var gs,Nb,uwe,jb,ap=y(()=>{S9();sp();gs=(t,e,r)=>{if(Nb.has(t))return Nb.get(t);let n=new lwe;return n.connected=!0,Nb.set(t,n),uwe({ipcEmitter:n,anyProcess:t,channel:e,isSubprocess:r}),n},Nb=new WeakMap,uwe=({ipcEmitter:t,anyProcess:e,channel:r,isSubprocess:n})=>{let i=b9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t});e.on("message",i),e.once("disconnect",v9.bind(void 0,{anyProcess:e,channel:r,isSubprocess:n,ipcEmitter:t,boundOnMessage:i})),y9(r,n)},jb=t=>{let e=Nb.get(t);return e===void 0?t.channel!==null:e.connected}});import{once as dwe}from"node:events";var E9,fwe,A9,w9,x9,O9,Mb,pwe,Fb,T9,Pb=y(()=>{Fl();Ob();Ub();Ml();ap();Cb();E9=({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:fwe++,type:Fb,message:n,hasListeners:s}},fwe=0n,A9=(t,e)=>{if(!(e?.type!==Fb||e.hasListeners))for(let{id:r}of t)r!==void 0&&Mb[r].resolve({isDeadlock:!0,hasListeners:!1})},w9=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:T9,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},x9=t=>{if(t?.type!==T9)return!1;let{id:e,message:r}=t;return Mb[e]?.resolve({isDeadlock:!1,hasListeners:r}),!0},O9=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,pwe(e,r,i)]);o&&a9(r),s||c9(r)}finally{i.abort(),delete Mb[t.id]}},Mb={},pwe=async(t,e,{signal:r})=>{Na(t,1,r),await dwe(t,"disconnect",{signal:r}),l9(e)},Fb="execa:ipc:request",T9="execa:ipc:response"});var R9,I9,$9,cp,Lb,mwe,Cb=y(()=>{Fl();xo();hs();Pb();R9=(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}},I9=({outgoingMessages:t,outgoingMessage:e})=>{t.delete(e),e.onMessageSent.resolve()},$9=async(t,e,r)=>{for(;!Lb(t,e)&&cp.get(t)?.size>0;){let n=[...cp.get(t)];A9(n,r),await Promise.all(n.map(({onMessageSent:i})=>i))}},cp=new WeakMap,Lb=(t,e)=>e.listenerCount("message")>mwe(t),mwe=t=>Ni.has(t)&&!wo(Ni.get(t).options.buffer,"ipc")?1:0});import{promisify as hwe}from"node:util";var zb,gwe,tI,ywe,eI,Ub=y(()=>{Ml();Cb();Pb();zb=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},i,{strict:o=!1}={})=>{let s="sendMessage";return Nl({methodName:s,isSubprocess:r,ipc:n,isConnected:t.connected}),gwe({anyProcess:t,channel:e,methodName:s,isSubprocess:r,message:i,strict:o})},gwe=async({anyProcess:t,channel:e,methodName:r,isSubprocess:n,message:i,strict:o})=>{let s=E9({anyProcess:t,channel:e,isSubprocess:n,message:i,strict:o}),a=R9(t,s,o);try{await tI({anyProcess:t,methodName:r,isSubprocess:n,wrappedMessage:s,message:i})}catch(c){throw jl(t),c}finally{I9(a)}},tI=async({anyProcess:t,methodName:e,isSubprocess:r,wrappedMessage:n,message:i})=>{let o=ywe(t);try{await Promise.all([O9(n,t,r),o(n)])}catch(s){throw f9({error:s,methodName:e,isSubprocess:r}),p9({error:s,methodName:e,isSubprocess:r,message:i}),s}},ywe=t=>{if(eI.has(t))return eI.get(t);let e=hwe(t.send.bind(t));return eI.set(t,e),e},eI=new WeakMap});import{scheduler as _we}from"node:timers/promises";var C9,D9,bwe,P9,k9,N9,QR,rI,Db=y(()=>{Ub();ap();Ml();C9=(t,e)=>{let r="cancelSignal";return JR(r,!1,t.connected),tI({anyProcess:t,methodName:r,isSubprocess:!1,wrappedMessage:{type:N9,message:e},message:e})},D9=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>(await bwe({anyProcess:t,channel:e,isSubprocess:r,ipc:n}),rI.signal),bwe=async({anyProcess:t,channel:e,isSubprocess:r,ipc:n})=>{if(!P9){if(P9=!0,!n){d9();return}if(e===null){QR();return}gs(t,e,r),await _we.yield()}},P9=!1,k9=t=>t?.type!==N9?!1:(rI.abort(t.message),!0),N9="execa:ipc:cancel",QR=()=>{rI.abort(u9())},rI=new AbortController});var j9,M9,vwe,Swe,nI=y(()=>{WR();Db();xb();j9=({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.")}},M9=({subprocess:t,cancelSignal:e,gracefulCancel:r,forceKillAfterDelay:n,context:i,controller:o})=>r?[vwe({subprocess:t,cancelSignal:e,forceKillAfterDelay:n,context:i,controller:o})]:[],vwe=async({subprocess:t,cancelSignal:e,forceKillAfterDelay:r,context:n,controller:{signal:i}})=>{await $b(e,i);let o=Swe(e);throw await C9(t,o),VR({kill:t.kill,forceKillAfterDelay:r,context:n,controllerSignal:i}),n.terminationReason??="gracefulCancel",e.reason},Swe=({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 wwe}from"node:timers/promises";var F9,L9,xwe,iI=y(()=>{Da();F9=({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})`)},L9=(t,e,r,n)=>e===0||e===void 0?[]:[xwe(t,e,r,n)],xwe=async(t,e,r,{signal:n})=>{throw await wwe(e,void 0,{signal:n}),r.terminationReason??="timeout",t.kill(),new ni}});import{execPath as $we,execArgv as kwe}from"node:process";import z9 from"node:path";var U9,q9,oI=y(()=>{Tl();U9=({options:t})=>{if(t.node===!1)throw new TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...t,node:!0}}},q9=(t,e,{node:r=!1,nodePath:n=$we,nodeOptions:i=kwe.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=Ol(n,'The "nodePath" option'),l=z9.resolve(o,c),u={...a,nodePath:l,node:r,cwd:o};if(!r)return[t,e,u];if(z9.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 Ewe}from"node:v8";var H9,Awe,Owe,Twe,B9,sI=y(()=>{H9=({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`.");Twe[r](t)}},Awe=t=>{try{Ewe(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with a structured clone.",{cause:e})}},Owe=t=>{try{JSON.stringify(t)}catch(e){throw new Error("The `ipcInput` option is not serializable with JSON.",{cause:e})}},Twe={advanced:Awe,json:Owe},B9=async(t,e)=>{e!==void 0&&await t.sendMessage(e)}});var Z9,Rwe,cn,aI,Iwe,G9,qb,ja=y(()=>{Z9=({encoding:t})=>{if(aI.has(t))return;let e=Iwe(t);if(e!==void 0)throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to ${qb(e)}.`);let r=[...aI].map(n=>qb(n)).join(", ");throw new TypeError(`Invalid option \`encoding: ${qb(t)}\`. +Please rename it to one of: ${r}.`)},Rwe=new Set(["utf8","utf16le"]),cn=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),aI=new Set([...Rwe,...cn]),Iwe=t=>{if(t===null)return"buffer";if(typeof t!="string")return;let e=t.toLowerCase();if(e in G9)return G9[e];if(aI.has(e))return e},G9={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"},qb=t=>typeof t=="string"?`"${t}"`:String(t)});import{statSync as Pwe}from"node:fs";import Cwe from"node:path";import Dwe from"node:process";var V9,W9,K9,cI=y(()=>{Tl();V9=(t=W9())=>{let e=Ol(t,'The "cwd" option');return Cwe.resolve(e)},W9=()=>{try{return Dwe.cwd()}catch(t){throw t.message=`The current directory does not exist. ${t.message}`,t}},K9=(t,e)=>{if(e===W9())return t;let r;try{r=Pwe(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 Nwe from"node:path";import J9 from"node:process";var Y9,Hb,jwe,Mwe,cI=y(()=>{Y9=wt(IV(),1);FV();xb();ip();WR();rI();nI();iI();oI();ja();aI();Ol();xo();Hb=(t,e,r)=>{r.cwd=V9(r.cwd);let[n,i,o]=q9(t,e,r),{command:s,args:a,options:c}=Y9.default._parse(n,i,o),l=vZ(c),u=jwe(l);return F9(u),Z9(u),H9(u),i9(u),j9(u),u.shell=xR(u.shell),u.env=Mwe(u),u.killSignal=QV(u.killSignal),u.forceKillAfterDelay=r9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),J9.platform==="win32"&&Nwe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jwe=({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}),Mwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...J9.env,...t}:t;return r||n?MV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,lI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function zl(t){if(typeof t=="string")return Fwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lwe(t)}var Fwe,Lwe,X9,zwe,Q9,Uwe,uI=y(()=>{Fwe=t=>t.at(-1)===X9?t.slice(0,t.at(-2)===Q9?-2:-1):t,Lwe=t=>t.at(-1)===zwe?t.subarray(0,t.at(-2)===Uwe?-2:-1):t,X9=` -`,zwe=X9.codePointAt(0),Q9="\r",Uwe=Q9.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 dI(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 fI(t,e){return dI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function eW(){return this[mI].next()}function tW(t){return this[mI].return(t)}function hI({preventCancel:t=!1}={}){let e=this.getReader(),r=new pI(e,t),n=Object.create(Hwe);return n[mI]=r,n}var qwe,pI,mI,Hwe,rW=y(()=>{qwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),pI=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}}},mI=Symbol();Object.defineProperty(eW,"name",{value:"next"});Object.defineProperty(tW,"name",{value:"return"});Hwe=Object.create(qwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:eW},return:{enumerable:!0,configurable:!0,writable:!0,value:tW}})});var nW=y(()=>{});var iW=y(()=>{rW();nW()});var oW,Bwe,Gwe,Zwe,lp,gI=y(()=>{Fa();iW();oW=t=>{if(Ma(t,{checkOpen:!1})&&lp.on!==void 0)return Gwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Bwe.call(t)==="[object ReadableStream]")return hI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Bwe}=Object.prototype,Gwe=async function*(t){let e=new AbortController,r={};Zwe(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()}},Zwe=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 Ul,Vwe,cW,sW,Wwe,aW,ji,up=y(()=>{gI();Ul=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=oW(t),u=e();u.length=0;try{for await(let d of l){let f=Wwe(d),p=r[f](d,u);cW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vwe({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}},Vwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&cW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},cW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){sW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&sW(c,e,i,o),new ji},sW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wwe=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=aW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&aW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:aW}=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 Ul(t,Xwe,e)}var Kwe,Jwe,Ywe,Xwe,lW=y(()=>{up();Wb();Kwe=()=>({contents:[]}),Jwe=()=>1,Ywe=(t,{contents:e})=>(e.push(t),e),Xwe={init:Kwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Jwe,truncateChunk:dp,addChunk:Ywe,getFinalChunk:dp,finalize:Gb}});async function Jb(t,e){return Ul(t,axe,e)}var Qwe,exe,txe,uW,dW,rxe,nxe,ixe,oxe,pW,fW,sxe,mW,axe,hW=y(()=>{up();Wb();Qwe=()=>({contents:new ArrayBuffer(0)}),exe=t=>txe.encode(t),txe=new TextEncoder,uW=t=>new Uint8Array(t),dW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rxe=(t,e)=>t.slice(0,e),nxe=(t,{contents:e,length:r},n)=>{let i=mW()?oxe(e,n):ixe(e,n);return new Uint8Array(i).set(t,r),i},ixe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(pW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oxe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:pW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},pW=t=>fW**Math.ceil(Math.log(t)/Math.log(fW)),fW=2,sxe=({contents:t,length:e})=>mW()?t:t.slice(0,e),mW=()=>"resize"in ArrayBuffer.prototype,axe={init:Qwe,convertChunk:{string:exe,buffer:uW,arrayBuffer:uW,dataView:dW,typedArray:dW,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:nxe,getFinalChunk:dp,finalize:sxe}});async function Xb(t,e){return Ul(t,fxe,e)}var cxe,Yb,lxe,uxe,dxe,fxe,gW=y(()=>{up();Wb();cxe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lxe=(t,{contents:e})=>e+t,uxe=(t,e)=>t.slice(0,e),dxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fxe={init:cxe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:uxe,addChunk:lxe,getFinalChunk:dxe,finalize:Gb}});var yW=y(()=>{lW();hW();gW();up()});import{on as pxe}from"node:events";import{finished as mxe}from"node:stream/promises";var Qb=y(()=>{gI();yW();Object.assign(lp,{on:pxe,finished:mxe})});var _W,hxe,bW,vW,gxe,SW,wW,ev,La=y(()=>{Qb();So();xo();_W=({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=hxe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hxe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",bW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},vW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gxe=(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}},SW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),wW=(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 yxe}from"node:util";var $W,_xe,bxe,vxe,Sxe,wxe,xW,kW=y(()=>{uI();an();aI();lb();La();ip();Da();$W=({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=_xe({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=vxe(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=>Sxe(D)).join(` +${t}`}});import Nwe from"node:path";import J9 from"node:process";var Y9,Hb,jwe,Mwe,lI=y(()=>{Y9=wt(IV(),1);FV();xb();ip();KR();nI();iI();oI();sI();ja();cI();Tl();xo();Hb=(t,e,r)=>{r.cwd=V9(r.cwd);let[n,i,o]=q9(t,e,r),{command:s,args:a,options:c}=Y9.default._parse(n,i,o),l=vZ(c),u=jwe(l);return F9(u),Z9(u),H9(u),i9(u),j9(u),u.shell=$R(u.shell),u.env=Mwe(u),u.killSignal=QV(u.killSignal),u.forceKillAfterDelay=r9(u.forceKillAfterDelay),u.lines=u.lines.map((d,f)=>d&&!cn.has(u.encoding)&&u.buffer[f]),J9.platform==="win32"&&Nwe.basename(s,".exe")==="cmd"&&a.unshift("/q"),{file:s,commandArguments:a,options:u}},jwe=({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}),Mwe=({env:t,extendEnv:e,preferLocal:r,node:n,localDirectory:i,nodePath:o})=>{let s=e?{...J9.env,...t}:t;return r||n?MV({env:s,cwd:i,execPath:o,preferLocal:r,addExecPath:n}):s}});var Bb,uI=y(()=>{Bb=(t,e,r)=>r.shell&&e.length>0?[[t,...e].join(" "),[],r]:[t,e,r]});function zl(t){if(typeof t=="string")return Fwe(t);if(!(ArrayBuffer.isView(t)&&t.BYTES_PER_ELEMENT===1))throw new Error("Input must be a string or a Uint8Array");return Lwe(t)}var Fwe,Lwe,X9,zwe,Q9,Uwe,dI=y(()=>{Fwe=t=>t.at(-1)===X9?t.slice(0,t.at(-2)===Q9?-2:-1):t,Lwe=t=>t.at(-1)===zwe?t.subarray(0,t.at(-2)===Uwe?-2:-1):t,X9=` +`,zwe=X9.codePointAt(0),Q9="\r",Uwe=Q9.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 fI(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 pI(t,e){return fI(t,e)&&Ma(t,e)}var Fa=y(()=>{});function eW(){return this[hI].next()}function tW(t){return this[hI].return(t)}function gI({preventCancel:t=!1}={}){let e=this.getReader(),r=new mI(e,t),n=Object.create(Hwe);return n[hI]=r,n}var qwe,mI,hI,Hwe,rW=y(()=>{qwe=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype),mI=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}}},hI=Symbol();Object.defineProperty(eW,"name",{value:"next"});Object.defineProperty(tW,"name",{value:"return"});Hwe=Object.create(qwe,{next:{enumerable:!0,configurable:!0,writable:!0,value:eW},return:{enumerable:!0,configurable:!0,writable:!0,value:tW}})});var nW=y(()=>{});var iW=y(()=>{rW();nW()});var oW,Bwe,Gwe,Zwe,lp,yI=y(()=>{Fa();iW();oW=t=>{if(Ma(t,{checkOpen:!1})&&lp.on!==void 0)return Gwe(t);if(typeof t?.[Symbol.asyncIterator]=="function")return t;if(Bwe.call(t)==="[object ReadableStream]")return gI.call(t);throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},{toString:Bwe}=Object.prototype,Gwe=async function*(t){let e=new AbortController,r={};Zwe(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()}},Zwe=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 Ul,Vwe,cW,sW,Wwe,aW,ji,up=y(()=>{yI();Ul=async(t,{init:e,convertChunk:r,getSize:n,truncateChunk:i,addChunk:o,getFinalChunk:s,finalize:a},{maxBuffer:c=Number.POSITIVE_INFINITY}={})=>{let l=oW(t),u=e();u.length=0;try{for await(let d of l){let f=Wwe(d),p=r[f](d,u);cW({convertedChunk:p,state:u,getSize:n,truncateChunk:i,addChunk:o,maxBuffer:c})}return Vwe({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}},Vwe=({state:t,getSize:e,truncateChunk:r,addChunk:n,getFinalChunk:i,maxBuffer:o})=>{let s=i(t);s!==void 0&&cW({convertedChunk:s,state:t,getSize:e,truncateChunk:r,addChunk:n,maxBuffer:o})},cW=({convertedChunk:t,state:e,getSize:r,truncateChunk:n,addChunk:i,maxBuffer:o})=>{let s=r(t),a=e.length+s;if(a<=o){sW(t,e,i,a);return}let c=n(t,o-e.length);throw c!==void 0&&sW(c,e,i,o),new ji},sW=(t,e,r,n)=>{e.contents=r(t,e,n),e.length=n},Wwe=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=aW.call(t);return r==="[object ArrayBuffer]"?"arrayBuffer":r==="[object DataView]"?"dataView":Number.isInteger(t.byteLength)&&Number.isInteger(t.byteOffset)&&aW.call(t.buffer)==="[object ArrayBuffer]"?"typedArray":"others"},{toString:aW}=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 Ul(t,Xwe,e)}var Kwe,Jwe,Ywe,Xwe,lW=y(()=>{up();Wb();Kwe=()=>({contents:[]}),Jwe=()=>1,Ywe=(t,{contents:e})=>(e.push(t),e),Xwe={init:Kwe,convertChunk:{string:$o,buffer:$o,arrayBuffer:$o,dataView:$o,typedArray:$o,others:$o},getSize:Jwe,truncateChunk:dp,addChunk:Ywe,getFinalChunk:dp,finalize:Gb}});async function Jb(t,e){return Ul(t,axe,e)}var Qwe,exe,txe,uW,dW,rxe,nxe,ixe,oxe,pW,fW,sxe,mW,axe,hW=y(()=>{up();Wb();Qwe=()=>({contents:new ArrayBuffer(0)}),exe=t=>txe.encode(t),txe=new TextEncoder,uW=t=>new Uint8Array(t),dW=t=>new Uint8Array(t.buffer,t.byteOffset,t.byteLength),rxe=(t,e)=>t.slice(0,e),nxe=(t,{contents:e,length:r},n)=>{let i=mW()?oxe(e,n):ixe(e,n);return new Uint8Array(i).set(t,r),i},ixe=(t,e)=>{if(e<=t.byteLength)return t;let r=new ArrayBuffer(pW(e));return new Uint8Array(r).set(new Uint8Array(t),0),r},oxe=(t,e)=>{if(e<=t.maxByteLength)return t.resize(e),t;let r=new ArrayBuffer(e,{maxByteLength:pW(e)});return new Uint8Array(r).set(new Uint8Array(t),0),r},pW=t=>fW**Math.ceil(Math.log(t)/Math.log(fW)),fW=2,sxe=({contents:t,length:e})=>mW()?t:t.slice(0,e),mW=()=>"resize"in ArrayBuffer.prototype,axe={init:Qwe,convertChunk:{string:exe,buffer:uW,arrayBuffer:uW,dataView:dW,typedArray:dW,others:Zb},getSize:Vb,truncateChunk:rxe,addChunk:nxe,getFinalChunk:dp,finalize:sxe}});async function Xb(t,e){return Ul(t,fxe,e)}var cxe,Yb,lxe,uxe,dxe,fxe,gW=y(()=>{up();Wb();cxe=()=>({contents:"",textDecoder:new TextDecoder}),Yb=(t,{textDecoder:e})=>e.decode(t,{stream:!0}),lxe=(t,{contents:e})=>e+t,uxe=(t,e)=>t.slice(0,e),dxe=({textDecoder:t})=>{let e=t.decode();return e===""?void 0:e},fxe={init:cxe,convertChunk:{string:$o,buffer:Yb,arrayBuffer:Yb,dataView:Yb,typedArray:Yb,others:Zb},getSize:Vb,truncateChunk:uxe,addChunk:lxe,getFinalChunk:dxe,finalize:Gb}});var yW=y(()=>{lW();hW();gW();up()});import{on as pxe}from"node:events";import{finished as mxe}from"node:stream/promises";var Qb=y(()=>{yI();yW();Object.assign(lp,{on:pxe,finished:mxe})});var _W,hxe,bW,vW,gxe,SW,wW,ev,La=y(()=>{Qb();So();xo();_W=({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=hxe(r,n,i);throw t.maxBufferInfo={fdNumber:o,unit:s},e.destroy(),t},hxe=(t,e,r)=>t?"objects":e?"lines":r==="buffer"?"bytes":"characters",bW=(t,e,r)=>{if(e.length!==r)return;let n=new ji;throw n.maxBufferInfo={fdNumber:"ipc"},n},vW=(t,e)=>{let{streamName:r,threshold:n,unit:i}=gxe(t,e);return`Command's ${r} was larger than ${n} ${i}`},gxe=(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}},SW=(t,e,r)=>t?.code==="ENOBUFS"&&e!==null&&e.some(n=>n!==null&&n.length>ev(r)),wW=(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 yxe}from"node:util";var $W,_xe,bxe,vxe,Sxe,wxe,xW,kW=y(()=>{dI();an();cI();lb();La();ip();Da();$W=({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=_xe({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=vxe(n,b),w=x===void 0?"":` +${x}`,R=`${S}: ${a}${w}`,A=e===void 0?[t[2],t[1]]:[e],O=[R,...A,...t.slice(3),r.map(D=>Sxe(D)).join(` `)].map(D=>ep(zl(wxe(D)))).filter(Boolean).join(` -`);return{originalMessage:x,shortMessage:R,message:T}},_xe=({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=bxe(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?`${vW(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"},bxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vxe=(t,e)=>{if(t instanceof ni)return;let r=UV(t)?t.originalMessage:String(t?.message??t),n=ep(K9(r,e));return n===""?void 0:n},Sxe=t=>typeof t=="string"?t:yxe(t),wxe=t=>Array.isArray(t)?t.map(e=>zl(xW(e))).filter(Boolean).join(` -`):xW(t),xW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,ql,fp,xxe,EW,$xe,pp=y(()=>{ip();hb();Da();kW();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>EW({command:t,escapedCommand:e,cwd:o,durationMs:CR(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:[]}),ql=({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}=$xe(l,u),{originalMessage:T,shortMessage:D,message:E}=$W({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=LV(t,E,x);return Object.assign(ae,xxe({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},xxe=({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})=>EW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:CR(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:[]}),EW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),$xe=(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 kxe(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(AW(t*1e3)%1e3),nanoseconds:Math.trunc(AW(t*1e6)%1e3)}}function Exe(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 yI(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kxe(t);break}case"bigint":return Exe(t)}throw new TypeError("Expected a finite number or bigint")}var AW,TW=y(()=>{AW=t=>Number.isFinite(t)?t:0});function _I(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+Oxe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Axe(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?" "+Txe(d,u):f;i.push(p)}},a=yI(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%Rxe):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 Axe,Txe,Oxe,Rxe,OW=y(()=>{TW();Axe=t=>t===0||t===0n,Txe=(t,e)=>e===1||e===1n?t:`${t}s`,Oxe=1e-7,Rxe=24n*60n*60n*1000n});var RW,IW=y(()=>{Pl();RW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var PW,Ixe,CW=y(()=>{OW();ps();Pl();IW();PW=(t,e)=>{Rl(e)&&(RW(t,e),Ixe(t,e))},Ixe=(t,e)=>{let r=`(done in ${_I(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Hl,rv=y(()=>{CW();Hl=(t,e,{reject:r})=>{if(PW(t,e),t.failed&&r)throw t;return t}});var jW,Pxe,Cxe,MW,FW,DW,Dxe,bI,NW,za,LW,Nxe,nv,zW,jxe,Mxe,vI,UW,Fxe,qW,iv,Lxe,SI,zxe,Uxe,HW,Cn,ov,wI,BW,GW,ys,$r=y(()=>{Fa();bo();an();jW=(t,e)=>za(t)?"asyncGenerator":LW(t)?"generator":nv(t)?"fileUrl":jxe(t)?"filePath":Lxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":zxe(t)?"asyncIterable":Uxe(t)?"iterable":SI(t)?MW({transform:t},e):Nxe(t)?Pxe(t,e):"native",Pxe=(t,e)=>fI(t.transform,{checkOpen:!1})?Cxe(t,e):SI(t.transform)?MW(t,e):Dxe(t,e),Cxe=(t,e)=>(FW(t,e,"Duplex stream"),"duplex"),MW=(t,e)=>(FW(t,e,"web TransformStream"),"webTransform"),FW=({final:t,binary:e,objectMode:r},n,i)=>{DW(t,`${n}.final`,i),DW(e,`${n}.binary`,i),bI(r,`${n}.objectMode`)},DW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Dxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!NW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(fI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(SI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!NW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return bI(r,`${i}.binary`),bI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},bI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},NW=t=>za(t)||LW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",LW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Nxe=t=>Ot(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",zW=t=>nv(t)&&t.protocol!=="file:",jxe=t=>Ot(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Mxe.has(e))&&vI(t.file),Mxe=new Set(["file","append"]),vI=t=>typeof t=="string",UW=(t,e)=>t==="native"&&typeof e=="string"&&!Fxe.has(e),Fxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),qW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Lxe=t=>qW(t)||iv(t),SI=t=>qW(t?.readable)&&iv(t?.writable),zxe=t=>HW(t)&&typeof t[Symbol.asyncIterator]=="function",Uxe=t=>HW(t)&&typeof t[Symbol.iterator]=="function",HW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),wI=new Set(["fileUrl","filePath"]),BW=new Set([...wI,"webStream","nodeStream"]),GW=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 xI,qxe,Hxe,ZW,$I=y(()=>{$r();xI=(t,e,r,n)=>n==="output"?qxe(t,e,r):Hxe(t,e,r),qxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hxe=(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}},ZW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var VW,Bxe,Gxe,Zxe,Vxe,Wxe,Kxe,WW=y(()=>{bo();ja();$r();$I();VW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Bxe(t,e,r,n)],Bxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Gxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Kxe(o,r)},Gxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Zxe({stdioItem:t,optionName:i}):e==="webTransform"?Vxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Wxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Zxe=({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}}},Vxe=({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}=xI(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Wxe=({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}=xI(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Kxe=(t,e)=>e==="input"?t.reverse():t});import kI from"node:process";var KW,Jxe,Yxe,Bl,EI,JW,Xxe,Qxe,YW=y(()=>{Fa();$r();KW=(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)??Qxe},Jxe=({type:t,value:e},r)=>Yxe[r]??JW[t](e),Yxe=["input","output","output"],Bl=()=>{},EI=()=>"input",JW={generator:Bl,asyncGenerator:Bl,fileUrl:Bl,filePath:Bl,iterable:EI,asyncIterable:EI,uint8Array:EI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?dI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Bl,duplex:Bl,native(t){let e=Xxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return JW.nodeStream(t)}},Xxe=t=>{if([0,kI.stdin].includes(t))return"input";if([1,2,kI.stdout,kI.stderr].includes(t))return"output"},Qxe="output"});var XW,QW=y(()=>{XW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var eK,e0e,t0e,tK,r0e,n0e,rK=y(()=>{So();QW();ps();eK=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=e0e(t,n).map((a,c)=>tK(a,c));return o?r0e(s,r,i):XW(s,e)},e0e=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(t0e(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},t0e=t=>Pn.some(e=>t[e]!==void 0),tK=(t,e)=>Array.isArray(t)?t.map(r=>tK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),r0e=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Il(r,i)&&n0e(n)?"ignore":n),n0e=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as i0e}from"node:fs";import o0e from"node:tty";var iK,s0e,a0e,c0e,l0e,nK,oK=y(()=>{Fa();So();an();hs();iK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?s0e({stdioItem:t,fdNumber:n,direction:i}):l0e({stdioItem:t,fdNumber:n}),s0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=a0e({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},a0e=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=c0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(o0e.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(i0e(i)),optionName:e}}},c0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},l0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:nK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:nK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,nK=(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 sK,u0e,d0e,f0e,p0e,aK=y(()=>{Fa();an();$r();sK=({input:t,inputFile:e},r)=>r===0?[...u0e(t),...f0e(e)]:[],u0e=t=>t===void 0?[]:[{type:d0e(t),value:t,optionName:"input"}],d0e=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.")},f0e=t=>t===void 0?[]:[{...p0e(t),optionName:"inputFile"}],p0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(vI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var cK,lK,m0e,h0e,uK,g0e,y0e,dK,fK=y(()=>{$r();cK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),lK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=m0e(i,t);if(s.length!==0){if(o){h0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BW.has(t))return uK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});GW.has(t)&&y0e({otherStdioItems:s,type:t,value:e,optionName:r})}},m0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),h0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{wI.has(e)&&uK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},uK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>g0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return dK(s,n,e),i==="output"?o[0].stream:void 0},g0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,y0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);dK(i,n,e)},dK=(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,_0e,b0e,v0e,S0e,w0e,x0e,$0e,k0e,E0e,A0e,T0e,AI,O0e,av=y(()=>{So();WW();$I();$r();YW();rK();oK();aK();fK();sv=(t,e,r,n)=>{let o=eK(e,r,n).map((a,c)=>_0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=E0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>O0e(a)),s},_0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=b0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=KW(o,e,i),c=o.map(d=>iK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=VW(c,i,a,r),u=ZW(l,a);return k0e(l,u),{direction:a,objectMode:u,stdioItems:l}},b0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>v0e(c,n)),...sK(r,e)],s=cK(o),a=s.length>1;return S0e(s,a,n),x0e(s),{stdioItems:s,isStdioArray:a}},v0e=(t,e)=>({type:jW(t,e),value:t,optionName:e}),S0e=(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(w0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},w0e=new Set(["ignore","ipc"]),x0e=t=>{for(let e of t)$0e(e)},$0e=({type:t,value:e,optionName:r})=>{if(zW(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(UW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},k0e=(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.`)},E0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(A0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw AI(i),o}},A0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>T0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},T0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=lK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},AI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},O0e=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 pK}from"node:fs";var hK,Mi,R0e,gK,mK,I0e,yK=y(()=>{an();av();$r();hK=(t,e)=>sv(I0e,t,e,!0),Mi=({type:t,optionName:e})=>{gK(e,ys[t])},R0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&gK(t,`"${e}"`),{}),gK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},mK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:R0e},I0e={input:{...mK,fileUrl:({value:t})=>({contents:[vo(pK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(pK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...mK,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,TI,mp=y(()=>{uI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?zl(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,RI,_K,bK,P0e,C0e,D0e,vK,N0e,OI,j0e,M0e,F0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:bK(e,n),RI=(t,e,r)=>r?t.flatMap(n=>_K(n,e)):_K(t,e),_K=(t,e)=>{let{transform:r,final:n}=bK(e,{});return[...r(t),...n()]},bK=(t,e)=>(e.previousChunks="",{transform:P0e.bind(void 0,e,t),final:D0e.bind(void 0,e)}),P0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=OI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=OI(n,r.slice(i+1))),t.previousChunks=n},C0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),D0e=function*({previousChunks:t}){t.length>0&&(yield t)},vK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:N0e.bind(void 0,n)},N0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?j0e:F0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},OI=(t,e)=>`${t}${e}`,j0e={windowsNewline:`\r +`);return{originalMessage:x,shortMessage:R,message:O}},_xe=({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=bxe(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?`${vW(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"},bxe=(t,e)=>t?` and was forcefully terminated after ${e} milliseconds`:"",vxe=(t,e)=>{if(t instanceof ni)return;let r=UV(t)?t.originalMessage:String(t?.message??t),n=ep(K9(r,e));return n===""?void 0:n},Sxe=t=>typeof t=="string"?t:yxe(t),wxe=t=>Array.isArray(t)?t.map(e=>zl(xW(e))).filter(Boolean).join(` +`):xW(t),xW=t=>typeof t=="string"?t:qt(t)?ib(t):""});var tv,ql,fp,xxe,EW,$xe,pp=y(()=>{ip();hb();Da();kW();tv=({command:t,escapedCommand:e,stdio:r,all:n,ipcOutput:i,options:{cwd:o},startTime:s})=>EW({command:t,escapedCommand:e,cwd:o,durationMs:DR(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:[]}),ql=({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}=$xe(l,u),{originalMessage:O,shortMessage:D,message:E}=$W({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=LV(t,E,x);return Object.assign(ae,xxe({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:O,shortMessage:D})),ae},xxe=({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})=>EW({shortMessage:b,originalMessage:g,command:e,escapedCommand:r,cwd:h,durationMs:DR(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:[]}),EW=t=>Object.fromEntries(Object.entries(t).filter(([,e])=>e!==void 0)),$xe=(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 kxe(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(AW(t*1e3)%1e3),nanoseconds:Math.trunc(AW(t*1e6)%1e3)}}function Exe(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 _I(t){switch(typeof t){case"number":{if(Number.isFinite(t))return kxe(t);break}case"bigint":return Exe(t)}throw new TypeError("Expected a finite number or bigint")}var AW,OW=y(()=>{AW=t=>Number.isFinite(t)?t:0});function bI(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+Txe);return(Math.round(f)/10**d).toFixed(d)},s=(u,d,f,p)=>{if(!((i.length===0||!e.colonNotation)&&Axe(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?" "+Oxe(d,u):f;i.push(p)}},a=_I(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%Rxe):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 Axe,Oxe,Txe,Rxe,TW=y(()=>{OW();Axe=t=>t===0||t===0n,Oxe=(t,e)=>e===1||e===1n?t:`${t}s`,Txe=1e-7,Rxe=24n*60n*60n*1000n});var RW,IW=y(()=>{Pl();RW=(t,e)=>{t.failed&&Ci({type:"error",verboseMessage:t.shortMessage,verboseInfo:e,result:t})}});var PW,Ixe,CW=y(()=>{TW();ps();Pl();IW();PW=(t,e)=>{Rl(e)&&(RW(t,e),Ixe(t,e))},Ixe=(t,e)=>{let r=`(done in ${bI(t.durationMs)})`;Ci({type:"duration",verboseMessage:r,verboseInfo:e,result:t})}});var Hl,rv=y(()=>{CW();Hl=(t,e,{reject:r})=>{if(PW(t,e),t.failed&&r)throw t;return t}});var jW,Pxe,Cxe,MW,FW,DW,Dxe,vI,NW,za,LW,Nxe,nv,zW,jxe,Mxe,SI,UW,Fxe,qW,iv,Lxe,wI,zxe,Uxe,HW,Cn,ov,xI,BW,GW,ys,$r=y(()=>{Fa();bo();an();jW=(t,e)=>za(t)?"asyncGenerator":LW(t)?"generator":nv(t)?"fileUrl":jxe(t)?"filePath":Lxe(t)?"webStream":oi(t,{checkOpen:!1})?"native":qt(t)?"uint8Array":zxe(t)?"asyncIterable":Uxe(t)?"iterable":wI(t)?MW({transform:t},e):Nxe(t)?Pxe(t,e):"native",Pxe=(t,e)=>pI(t.transform,{checkOpen:!1})?Cxe(t,e):wI(t.transform)?MW(t,e):Dxe(t,e),Cxe=(t,e)=>(FW(t,e,"Duplex stream"),"duplex"),MW=(t,e)=>(FW(t,e,"web TransformStream"),"webTransform"),FW=({final:t,binary:e,objectMode:r},n,i)=>{DW(t,`${n}.final`,i),DW(e,`${n}.binary`,i),vI(r,`${n}.objectMode`)},DW=(t,e,r)=>{if(t!==void 0)throw new TypeError(`The \`${e}\` option can only be defined when using a generator, not a ${r}.`)},Dxe=({transform:t,final:e,binary:r,objectMode:n},i)=>{if(t!==void 0&&!NW(t))throw new TypeError(`The \`${i}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(pI(e,{checkOpen:!1}))throw new TypeError(`The \`${i}.final\` option must not be a Duplex stream.`);if(wI(e))throw new TypeError(`The \`${i}.final\` option must not be a web TransformStream.`);if(e!==void 0&&!NW(e))throw new TypeError(`The \`${i}.final\` option must be a generator.`);return vI(r,`${i}.binary`),vI(n,`${i}.objectMode`),za(t)||za(e)?"asyncGenerator":"generator"},vI=(t,e)=>{if(t!==void 0&&typeof t!="boolean")throw new TypeError(`The \`${e}\` option must use a boolean.`)},NW=t=>za(t)||LW(t),za=t=>Object.prototype.toString.call(t)==="[object AsyncGeneratorFunction]",LW=t=>Object.prototype.toString.call(t)==="[object GeneratorFunction]",Nxe=t=>Tt(t)&&(t.transform!==void 0||t.final!==void 0),nv=t=>Object.prototype.toString.call(t)==="[object URL]",zW=t=>nv(t)&&t.protocol!=="file:",jxe=t=>Tt(t)&&Object.keys(t).length>0&&Object.keys(t).every(e=>Mxe.has(e))&&SI(t.file),Mxe=new Set(["file","append"]),SI=t=>typeof t=="string",UW=(t,e)=>t==="native"&&typeof e=="string"&&!Fxe.has(e),Fxe=new Set(["ipc","ignore","inherit","overlapped","pipe"]),qW=t=>Object.prototype.toString.call(t)==="[object ReadableStream]",iv=t=>Object.prototype.toString.call(t)==="[object WritableStream]",Lxe=t=>qW(t)||iv(t),wI=t=>qW(t?.readable)&&iv(t?.writable),zxe=t=>HW(t)&&typeof t[Symbol.asyncIterator]=="function",Uxe=t=>HW(t)&&typeof t[Symbol.iterator]=="function",HW=t=>typeof t=="object"&&t!==null,Cn=new Set(["generator","asyncGenerator","duplex","webTransform"]),ov=new Set(["fileUrl","filePath","fileNumber"]),xI=new Set(["fileUrl","filePath"]),BW=new Set([...xI,"webStream","nodeStream"]),GW=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 $I,qxe,Hxe,ZW,kI=y(()=>{$r();$I=(t,e,r,n)=>n==="output"?qxe(t,e,r):Hxe(t,e,r),qxe=(t,e,r)=>{let n=e!==0&&r[e-1].value.readableObjectMode;return{writableObjectMode:n,readableObjectMode:t??n}},Hxe=(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}},ZW=(t,e)=>{let r=t.findLast(({type:n})=>Cn.has(n));return r===void 0?!1:e==="input"?r.value.writableObjectMode:r.value.readableObjectMode}});var VW,Bxe,Gxe,Zxe,Vxe,Wxe,Kxe,WW=y(()=>{bo();ja();$r();kI();VW=(t,e,r,n)=>[...t.filter(({type:i})=>!Cn.has(i)),...Bxe(t,e,r,n)],Bxe=(t,e,r,{encoding:n})=>{let i=t.filter(({type:s})=>Cn.has(s)),o=Array.from({length:i.length});for(let[s,a]of Object.entries(i))o[s]=Gxe({stdioItem:a,index:Number(s),newTransforms:o,optionName:e,direction:r,encoding:n});return Kxe(o,r)},Gxe=({stdioItem:t,stdioItem:{type:e},index:r,newTransforms:n,optionName:i,direction:o,encoding:s})=>e==="duplex"?Zxe({stdioItem:t,optionName:i}):e==="webTransform"?Vxe({stdioItem:t,index:r,newTransforms:n,direction:o}):Wxe({stdioItem:t,index:r,newTransforms:n,direction:o,encoding:s}),Zxe=({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}}},Vxe=({stdioItem:t,stdioItem:{value:e},index:r,newTransforms:n,direction:i})=>{let{transform:o,objectMode:s}=Tt(e)?e:{transform:e},{writableObjectMode:a,readableObjectMode:c}=$I(s,r,n,i);return{...t,value:{transform:o,writableObjectMode:a,readableObjectMode:c}}},Wxe=({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}=Tt(e)?e:{transform:e},d=c||cn.has(o),{writableObjectMode:f,readableObjectMode:p}=$I(u,r,n,i);return{...t,value:{transform:s,final:a,binary:d,preserveNewlines:l,writableObjectMode:f,readableObjectMode:p}}},Kxe=(t,e)=>e==="input"?t.reverse():t});import EI from"node:process";var KW,Jxe,Yxe,Bl,AI,JW,Xxe,Qxe,YW=y(()=>{Fa();$r();KW=(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)??Qxe},Jxe=({type:t,value:e},r)=>Yxe[r]??JW[t](e),Yxe=["input","output","output"],Bl=()=>{},AI=()=>"input",JW={generator:Bl,asyncGenerator:Bl,fileUrl:Bl,filePath:Bl,iterable:AI,asyncIterable:AI,uint8Array:AI,webStream:t=>iv(t)?"output":"input",nodeStream(t){return Ma(t,{checkOpen:!1})?fI(t,{checkOpen:!1})?void 0:"input":"output"},webTransform:Bl,duplex:Bl,native(t){let e=Xxe(t);if(e!==void 0)return e;if(oi(t,{checkOpen:!1}))return JW.nodeStream(t)}},Xxe=t=>{if([0,EI.stdin].includes(t))return"input";if([1,2,EI.stdout,EI.stderr].includes(t))return"output"},Qxe="output"});var XW,QW=y(()=>{XW=(t,e)=>e&&!t.includes("ipc")?[...t,"ipc"]:t});var eK,e0e,t0e,tK,r0e,n0e,rK=y(()=>{So();QW();ps();eK=({stdio:t,ipc:e,buffer:r,...n},i,o)=>{let s=e0e(t,n).map((a,c)=>tK(a,c));return o?r0e(s,r,i):XW(s,e)},e0e=(t,e)=>{if(t===void 0)return Pn.map(n=>e[n]);if(t0e(e))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${Pn.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,Pn.length);return Array.from({length:r},(n,i)=>t[i])},t0e=t=>Pn.some(e=>t[e]!==void 0),tK=(t,e)=>Array.isArray(t)?t.map(r=>tK(r,e)):t??(e>=Pn.length?"ignore":"pipe"),r0e=(t,e,r)=>t.map((n,i)=>!e[i]&&i!==0&&!Il(r,i)&&n0e(n)?"ignore":n),n0e=t=>t==="pipe"||Array.isArray(t)&&t.every(e=>e==="pipe")});import{readFileSync as i0e}from"node:fs";import o0e from"node:tty";var iK,s0e,a0e,c0e,l0e,nK,oK=y(()=>{Fa();So();an();hs();iK=({stdioItem:t,stdioItem:{type:e},isStdioArray:r,fdNumber:n,direction:i,isSync:o})=>!r||e!=="native"?t:o?s0e({stdioItem:t,fdNumber:n,direction:i}):l0e({stdioItem:t,fdNumber:n}),s0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n,direction:i})=>{let o=a0e({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},a0e=({value:t,optionName:e,fdNumber:r,direction:n})=>{let i=c0e(t,r);if(i!==void 0){if(n==="output")return{type:"fileNumber",value:i,optionName:e};if(o0e.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(i0e(i)),optionName:e}}},c0e=(t,e)=>{if(t==="inherit")return e;if(typeof t=="number")return t;let r=ob.indexOf(t);if(r!==-1)return r},l0e=({stdioItem:t,stdioItem:{value:e,optionName:r},fdNumber:n})=>e==="inherit"?{type:"nodeStream",value:nK(n,e,r),optionName:r}:typeof e=="number"?{type:"nodeStream",value:nK(e,e,r),optionName:r}:oi(e,{checkOpen:!1})?{type:"nodeStream",value:e,optionName:r}:t,nK=(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 sK,u0e,d0e,f0e,p0e,aK=y(()=>{Fa();an();$r();sK=({input:t,inputFile:e},r)=>r===0?[...u0e(t),...f0e(e)]:[],u0e=t=>t===void 0?[]:[{type:d0e(t),value:t,optionName:"input"}],d0e=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.")},f0e=t=>t===void 0?[]:[{...p0e(t),optionName:"inputFile"}],p0e=t=>{if(nv(t))return{type:"fileUrl",value:t};if(SI(t))return{type:"filePath",value:{file:t}};throw new Error("The `inputFile` option must be a file path string or a file URL.")}});var cK,lK,m0e,h0e,uK,g0e,y0e,dK,fK=y(()=>{$r();cK=t=>t.filter((e,r)=>t.every((n,i)=>e.value!==n.value||r>=i||e.type==="generator"||e.type==="asyncGenerator")),lK=({stdioItem:{type:t,value:e,optionName:r},direction:n,fileDescriptors:i,isSync:o})=>{let s=m0e(i,t);if(s.length!==0){if(o){h0e({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});return}if(BW.has(t))return uK({otherStdioItems:s,type:t,value:e,optionName:r,direction:n});GW.has(t)&&y0e({otherStdioItems:s,type:t,value:e,optionName:r})}},m0e=(t,e)=>t.flatMap(({direction:r,stdioItems:n})=>n.filter(i=>i.type===e).map((i=>({...i,direction:r})))),h0e=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{xI.has(e)&&uK({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})},uK=({otherStdioItems:t,type:e,value:r,optionName:n,direction:i})=>{let o=t.filter(a=>g0e(a,r));if(o.length===0)return;let s=o.find(a=>a.direction!==i);return dK(s,n,e),i==="output"?o[0].stream:void 0},g0e=({type:t,value:e},r)=>t==="filePath"?e.file===r.file:t==="fileUrl"?e.href===r.href:e===r,y0e=({otherStdioItems:t,type:e,value:r,optionName:n})=>{let i=t.find(({value:{transform:o}})=>o===r.transform);dK(i,n,e)},dK=(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,_0e,b0e,v0e,S0e,w0e,x0e,$0e,k0e,E0e,A0e,O0e,OI,T0e,av=y(()=>{So();WW();kI();$r();YW();rK();oK();aK();fK();sv=(t,e,r,n)=>{let o=eK(e,r,n).map((a,c)=>_0e({stdioOption:a,fdNumber:c,options:e,isSync:n})),s=E0e({initialFileDescriptors:o,addProperties:t,options:e,isSync:n});return e.stdio=s.map(({stdioItems:a})=>T0e(a)),s},_0e=({stdioOption:t,fdNumber:e,options:r,isSync:n})=>{let i=sb(e),{stdioItems:o,isStdioArray:s}=b0e({stdioOption:t,fdNumber:e,options:r,optionName:i}),a=KW(o,e,i),c=o.map(d=>iK({stdioItem:d,isStdioArray:s,fdNumber:e,direction:a,isSync:n})),l=VW(c,i,a,r),u=ZW(l,a);return k0e(l,u),{direction:a,objectMode:u,stdioItems:l}},b0e=({stdioOption:t,fdNumber:e,options:r,optionName:n})=>{let o=[...(Array.isArray(t)?t:[t]).map(c=>v0e(c,n)),...sK(r,e)],s=cK(o),a=s.length>1;return S0e(s,a,n),x0e(s),{stdioItems:s,isStdioArray:a}},v0e=(t,e)=>({type:jW(t,e),value:t,optionName:e}),S0e=(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(w0e.has(n))throw new Error(`The \`${i}\` option must not include \`${n}\`.`)}},w0e=new Set(["ignore","ipc"]),x0e=t=>{for(let e of t)$0e(e)},$0e=({type:t,value:e,optionName:r})=>{if(zW(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(UW(t,e))throw new TypeError(`The \`${r}: { file: '...' }\` option must be used instead of \`${r}: '...'\`.`)},k0e=(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.`)},E0e=({initialFileDescriptors:t,addProperties:e,options:r,isSync:n})=>{let i=[];try{for(let o of t)i.push(A0e({fileDescriptor:o,fileDescriptors:i,addProperties:e,options:r,isSync:n}));return i}catch(o){throw OI(i),o}},A0e=({fileDescriptor:{direction:t,objectMode:e,stdioItems:r},fileDescriptors:n,addProperties:i,options:o,isSync:s})=>{let a=r.map(c=>O0e({stdioItem:c,addProperties:i,direction:t,options:o,fileDescriptors:n,isSync:s}));return{direction:t,objectMode:e,stdioItems:a}},O0e=({stdioItem:t,addProperties:e,direction:r,options:n,fileDescriptors:i,isSync:o})=>{let s=lK({stdioItem:t,direction:r,fileDescriptors:i,isSync:o});return s!==void 0?{...t,stream:s}:{...t,...e[r][t.type](t,n)}},OI=t=>{for(let{stdioItems:e}of t)for(let{stream:r}of e)r!==void 0&&!ri(r)&&r.destroy()},T0e=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 pK}from"node:fs";var hK,Mi,R0e,gK,mK,I0e,yK=y(()=>{an();av();$r();hK=(t,e)=>sv(I0e,t,e,!0),Mi=({type:t,optionName:e})=>{gK(e,ys[t])},R0e=({optionName:t,value:e})=>((e==="ipc"||e==="overlapped")&&gK(t,`"${e}"`),{}),gK=(t,e)=>{throw new TypeError(`The \`${t}\` option cannot be ${e} with synchronous methods.`)},mK={generator(){},asyncGenerator:Mi,webStream:Mi,nodeStream:Mi,webTransform:Mi,duplex:Mi,asyncIterable:Mi,native:R0e},I0e={input:{...mK,fileUrl:({value:t})=>({contents:[vo(pK(t))]}),filePath:({value:{file:t}})=>({contents:[vo(pK(t))]}),fileNumber:Mi,iterable:({value:t})=>({contents:[...t]}),string:({value:t})=>({contents:[t]}),uint8Array:({value:t})=>({contents:[t]})},output:{...mK,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,TI,mp=y(()=>{dI();ko=(t,{stripFinalNewline:e},r)=>TI(e,r)&&t!==void 0&&!Array.isArray(t)?zl(t):t,TI=(t,e)=>e==="all"?t[1]||t[2]:t[e]});var cv,II,_K,bK,P0e,C0e,D0e,vK,N0e,RI,j0e,M0e,F0e,lv=y(()=>{cv=(t,e,r,n)=>t||r?void 0:bK(e,n),II=(t,e,r)=>r?t.flatMap(n=>_K(n,e)):_K(t,e),_K=(t,e)=>{let{transform:r,final:n}=bK(e,{});return[...r(t),...n()]},bK=(t,e)=>(e.previousChunks="",{transform:P0e.bind(void 0,e,t),final:D0e.bind(void 0,e)}),P0e=function*(t,e,r){if(typeof r!="string"){yield r;return}let{previousChunks:n}=t,i=-1;for(let o=0;o0&&(a=RI(n,a),n=""),yield a,i=o}i!==r.length-1&&(n=RI(n,r.slice(i+1))),t.previousChunks=n},C0e=(t,e,r,n)=>r?0:(n.isWindowsNewline=e!==0&&t[e-1]==="\r",n.isWindowsNewline?2:1),D0e=function*({previousChunks:t}){t.length>0&&(yield t)},vK=({binary:t,preserveNewlines:e,readableObjectMode:r,state:n})=>t||e||r?void 0:{transform:N0e.bind(void 0,n)},N0e=function*({isWindowsNewline:t=!1},e){let{unixNewline:r,windowsNewline:n,LF:i,concatBytes:o}=typeof e=="string"?j0e:F0e;if(e.at(-1)===i){yield e;return}yield o(e,t?n:r)},RI=(t,e)=>`${t}${e}`,j0e={windowsNewline:`\r `,unixNewline:` `,LF:` -`,concatBytes:OI},M0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},F0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:M0e}});import{Buffer as L0e}from"node:buffer";var SK,z0e,wK,U0e,q0e,xK,$K=y(()=>{an();SK=(t,e)=>t?void 0:z0e.bind(void 0,e),z0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!L0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},wK=(t,e)=>t?U0e.bind(void 0,e):q0e.bind(void 0,e),U0e=function*(t,e){xK(t,e),yield e},q0e=function*(t,e){if(xK(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},xK=(t,e)=>{if(e==null)throw new TypeError(`The \`${t}\` option's function must not call \`yield ${e}\`. +`,concatBytes:RI},M0e=(t,e)=>{let r=new Uint8Array(t.length+e.length);return r.set(t,0),r.set(e,t.length),r},F0e={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:M0e}});import{Buffer as L0e}from"node:buffer";var SK,z0e,wK,U0e,q0e,xK,$K=y(()=>{an();SK=(t,e)=>t?void 0:z0e.bind(void 0,e),z0e=function*(t,e){if(typeof e!="string"&&!qt(e)&&!L0e.isBuffer(e))throw new TypeError(`The \`${t}\` option's transform must use "objectMode: true" to receive as input: ${typeof e}.`);yield e},wK=(t,e)=>t?U0e.bind(void 0,e):q0e.bind(void 0,e),U0e=function*(t,e){xK(t,e),yield e},q0e=function*(t,e){if(xK(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},xK=(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 H0e}from"node:buffer";import{StringDecoder as B0e}from"node:string_decoder";var uv,G0e,Z0e,V0e,II=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:G0e.bind(void 0,new TextEncoder)};let n=new B0e(e);return{transform:Z0e.bind(void 0,n),final:V0e.bind(void 0,n)}},G0e=function*(t,e){H0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},Z0e=function*(t,e){yield qt(e)?t.write(e):e},V0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as kK}from"node:util";var PI,dv,EK,W0e,AK,K0e,TK=y(()=>{PI=kK(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=K0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},EK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*W0e(r,Number(e),t)},W0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},AK=kK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),K0e=function*(t){yield t}});var CI,OK,Ua,hp,J0e,Y0e,DI=y(()=>{CI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},OK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...hp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Y0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},hp=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)},Y0e=function*(t){yield t}});import{Transform as X0e,getDefaultHighWaterMark as RK}from"node:stream";var NI,fv,IK,pv=y(()=>{$r();lv();$K();II();TK();DI();NI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=IK(t,s,o),l=za(e),u=za(r),d=l?PI.bind(void 0,dv,a):CI.bind(void 0,Ua),f=l||u?PI.bind(void 0,EK,a):CI.bind(void 0,hp),p=l||u?AK.bind(void 0,a):void 0;return{stream:new X0e({writableObjectMode:n,writableHighWaterMark:RK(n),readableObjectMode:i,readableHighWaterMark:RK(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=IK(s,r,a);t=OK(c,t)}return t},IK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:SK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:wK(i,a)},vK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var PK,Q0e,e$e,t$e,r$e,CK=y(()=>{pv();an();$r();PK=(t,e)=>{for(let r of Q0e(t))e$e(t,r,e)},Q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),e$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=>t$e(a,n));r.input=Qf(s)},t$e=(t,e)=>{let r=fv(t,e,"utf8",!0);return r$e(r),Qf(r)},r$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,n$e,i$e,DK,NK,o$e,jK,jI=y(()=>{ja();$r();Pl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Il(r,n)&&!cn.has(e)&&n$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&i$e.has(o))||t.every(({type:i})=>Cn.has(i))),n$e=t=>t===1||t===2,i$e=new Set(["pipe","overlapped"]),DK=async(t,e,r,n)=>{for await(let i of t)o$e(e)||jK(i,r,n)},NK=(t,e,r)=>{for(let n of t)jK(n,e,r)},o$e=t=>t._readableState.pipes.length>0,jK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as s$e,appendFileSync as a$e}from"node:fs";var MK,c$e,l$e,u$e,d$e,f$e,FK=y(()=>{jI();pv();lv();an();$r();La();MK=({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)=>c$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},c$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=wW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=l$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=u$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});d$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&&f$e(b,m,i),S}catch(x){return n.error=x,S}},l$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},u$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=fZ(t,r);return n[o]?{serializedResult:s,finalResult:RI(s,!i[o],e)}:{serializedResult:s}},d$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=RI(t,!1,s);try{NK(a,e,n)}catch(c){r.error??=c}},f$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)?a$e(n,t):(r.add(o),s$e(n,t))}}});var LK,zK=y(()=>{an();mp();LK=([,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)?kR([t,e]):`${t}${e}`}});import{once as MI}from"node:events";var UK,p$e,qK,HK,m$e,FI,LI=y(()=>{Da();UK=async(t,e)=>{let[r,n]=await p$e(t);return e.isForcefullyTerminated??=!1,[r,n]},p$e=async t=>{let[e,r]=await Promise.allSettled([MI(t,"spawn"),MI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qK(t):r.value},qK=async t=>{try{return await MI(t,"exit")}catch{return qK(t)}},HK=async t=>{let[e,r]=await t;if(!m$e(e,r)&&FI(e,r))throw new ni;return[e,r]},m$e=(t,e)=>t===void 0&&e===void 0,FI=(t,e)=>t!==0||e!==null});var BK,h$e,GK=y(()=>{Da();La();LI();BK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=h$e(t,e,r),s=o?.code==="ETIMEDOUT",a=SW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},h$e=(t,e,r)=>t!==void 0?t:FI(e,r)?new ni:void 0});import{spawnSync as g$e}from"node:child_process";var ZK,y$e,_$e,b$e,hv,v$e,S$e,w$e,x$e,VK=y(()=>{DR();cI();lI();pp();rv();yK();mp();CK();FK();La();zK();GK();ZK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=y$e(t,e,r),d=v$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Hl(d,c,l)},y$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=_$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);b$e(u);let d=hK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,b$e=({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.`)},v$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=S$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}=BK(c,r),{output:m,error:h=l}=MK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(LK(m,r),r,"all");return x$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},S$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{PK(o,r);let a=w$e(r);return g$e(...Bb(t,e,a))}catch(a){return ql({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},w$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),x$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?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 zI,on as $$e}from"node:events";var WK,k$e,E$e,A$e,T$e,KK=y(()=>{Ml();ap();sp();WK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Nl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),k$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),k$e=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([E$e(o,n,s),A$e(o,r,s),T$e(o,r,s)])}catch(a){throw jl(t),a}finally{s.abort(),Rb(e,i)}},E$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await zI(t,"message",{signal:r});return n}for await(let[n]of $$e(t,"message",{signal:r}))if(e(n))return n},A$e=async(t,e,{signal:r})=>{await zI(t,"disconnect",{signal:r}),s9(e)},T$e=async(t,e,{signal:r})=>{let[n]=await zI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as YK,on as O$e}from"node:events";var XK,UI,R$e,I$e,P$e,JK,qI=y(()=>{Ml();ap();sp();XK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>UI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),UI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Nl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Ob(e,o);let s=gs(t,e,r),a=new AbortController,c={};return R$e(t,s,a),I$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),P$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},R$e=async(t,e,r)=>{try{await YK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},I$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await YK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},P$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 O$e(r,"message",{signal:o.signal}))JK(s),yield c}catch{JK(s)}finally{o.abort(),Rb(e,a),n||jl(t),i&&await t}},JK=({error:t})=>{if(t)throw t}});import QK from"node:process";var e3,t3,r3,HI=y(()=>{Ub();KK();qI();Db();e3=(t,{ipc:e})=>{Object.assign(t,r3(t,!1,e))},t3=()=>{let t=QK,e=!0,r=QK.channel!==void 0;return{...r3(t,e,r),getCancelSignal:D9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},r3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:WK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:XK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as C$e}from"node:child_process";import{PassThrough as D$e,Readable as N$e,Writable as j$e,Duplex as M$e}from"node:stream";var n3,F$e,gp,L$e,z$e,U$e,q$e,i3=y(()=>{av();pp();rv();n3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{AI(n);let a=new C$e;F$e(a,n),Object.assign(a,{readable:L$e,writable:z$e,duplex:U$e});let c=ql({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=q$e(c,s,i);return{subprocess:a,promise:l}},F$e=(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 D$e;return t.end(),t},L$e=()=>new N$e({read(){}}),z$e=()=>new j$e({write(){}}),U$e=()=>new M$e({read(){},write(){}}),q$e=async(t,e,r)=>Hl(t,e,r)});import{createReadStream as o3,createWriteStream as s3}from"node:fs";import{Buffer as H$e}from"node:buffer";import{Readable as yp,Writable as B$e,Duplex as G$e}from"node:stream";var c3,_p,a3,Z$e,l3=y(()=>{pv();av();$r();c3=(t,e)=>sv(Z$e,t,e,!1),_p=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},a3={fileNumber:_p,generator:NI,asyncGenerator:NI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:G$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Z$e={input:{...a3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t}})=>({stream:o3(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(H$e.from(t))})},output:{...a3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t,append:e}})=>({stream:s3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:B$e.fromWeb(t)}),iterable:_p,asyncIterable:_p,string:_p,uint8Array:_p}}});import{on as V$e,once as u3}from"node:events";import{PassThrough as W$e,getDefaultHighWaterMark as K$e}from"node:stream";import{finished as p3}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)GI(i);let e=t.some(({readableObjectMode:i})=>i),r=J$e(t,e),n=new BI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var J$e,BI,Y$e,X$e,Q$e,GI,eke,tke,rke,nke,ike,m3,h3,ZI,g3,oke,gv,d3,f3,yv=y(()=>{J$e=(t,e)=>{if(t.length===0)return K$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},BI=class extends W$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(GI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Y$e(this,this.#t,this.#o);let r=eke({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(GI(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)}},Y$e=async(t,e,r)=>{gv(t,d3);let n=new AbortController;try{await Promise.race([X$e(t,n),Q$e(t,e,r,n)])}finally{n.abort(),gv(t,-d3)}},X$e=async(t,{signal:e})=>{try{await p3(t,{signal:e,cleanup:!0})}catch(r){throw m3(t,r),r}},Q$e=async(t,e,r,{signal:n})=>{for await(let[i]of V$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},GI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},eke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,f3);let a=new AbortController;try{await Promise.race([tke(o,e,a),rke({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),nke({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-f3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?ZI(t):ike(t))},tke=async(t,e,{signal:r})=>{try{await t,r.aborted||ZI(e)}catch(n){r.aborted||m3(e,n)}},rke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await p3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;h3(s)?i.add(e):g3(t,s)}},nke=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await u3(t,i,{signal:o}),!t.readable)return u3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},ike=t=>{t.writable&&t.end()},m3=(t,e)=>{h3(e)?ZI(t):g3(t,e)},h3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",ZI=t=>{(t.readable||t.writable)&&t.destroy()},g3=(t,e)=>{t.destroyed||(t.once("error",oke),t.destroy(e))},oke=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},d3=2,f3=1});import{finished as y3}from"node:stream/promises";var Gl,ske,VI,ake,WI,_v=y(()=>{So();Gl=(t,e)=>{t.pipe(e),ske(t,e),ake(t,e)},ske=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}VI(e)}},VI=t=>{t.writable&&t.end()},ake=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}WI(t)}},WI=t=>{t.readable&&t.destroy()}});var _3,cke,lke,uke,dke,fke,b3=y(()=>{yv();So();Tb();$r();_v();_3=(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})=>Cn.has(c)))cke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))uke({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);Gl(s,i)}},cke=(t,e,r,n)=>{r==="output"?Gl(t.stdio[n],e):Gl(e,t.stdio[n]);let i=lke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},lke=["stdin","stdout","stderr"],uke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;dke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},dke=(t,{signal:e})=>{ri(t)&&Na(t,fke,e)},fke=2});var Ha,v3=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 bv,KI,JI,pke,YI,vv,mke,XI,QI,eP,S3,alt,clt,w3=y(()=>{v3();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",KI=Symbol.for("signal-exit emitter"),JI=globalThis,pke=Object.defineProperty.bind(Object),YI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(JI[KI])return JI[KI];pke(JI,KI,{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{},mke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),XI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},QI=class extends vv{#t=eP.platform==="win32"?"SIGINT":"SIGHUP";#r=new YI;#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(!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 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 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)}},eP=globalThis.process,{onExit:S3,load:alt,unload:clt}=mke(bv(eP)?new QI(eP):new XI)});import{addAbortListener as hke}from"node:events";var x3,$3=y(()=>{w3();x3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=S3(()=>{t.kill()});hke(n,()=>{i()})}});var E3,gke,yke,k3,_ke,A3=y(()=>{$R();hb();hs();Ol();E3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=gke(r,n,i),{sourceStream:d,sourceError:f}=_ke(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}},gke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=yke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},yke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(k3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||wR(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(k3)(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}`)},k3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_ke=(t,e)=>{try{return{sourceStream:Ll(t,e)}}catch(r){return{sourceError:r}}}});var O3,bke,tP,T3,rP=y(()=>{pp();_v();O3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw tP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return WI(t),n;if(e!==void 0)return VI(r),e},tP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>ql({error:t,command:T3,escapedCommand:T3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),T3="source.pipe(destination)"});var R3,I3=y(()=>{R3=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 vke}from"node:stream/promises";var P3,Ske,wke,xke,Sv,$ke,kke,C3=y(()=>{yv();Tb();_v();P3=(t,e,r)=>{let n=Sv.has(e)?wke(t,e):Ske(t,e);return Na(t,$ke,r.signal),Na(e,kke,r.signal),xke(e),n},Ske=(t,e)=>{let r=qa([t]);return Gl(r,e),Sv.set(e,r),r},wke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},xke=async t=>{try{await vke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,$ke=2,kke=1});import{aborted as Eke}from"node:util";var D3,Ake,N3=y(()=>{rP();D3=(t,e)=>t===void 0?[]:[Ake(t,e)],Ake=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Eke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw tP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,Tke,Oke,j3=y(()=>{bo();A3();rP();I3();C3();N3();wv=(t,...e)=>{if(Ot(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=E3(t,...e),i=Tke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Tke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Oke(t,i);O3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=P3(e,o,d);return await Promise.race([R3(u),...D3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Oke=(t,e)=>Promise.allSettled([t,e])});import{on as Rke}from"node:events";import{getDefaultHighWaterMark as Ike}from"node:stream";var xv,Pke,nP,Cke,F3,iP,M3,Dke,Nke,$v=y(()=>{II();lv();DI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Pke(e,s),F3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Pke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},nP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Cke(e,s,t);let a=t.readableObjectMode&&!o;return F3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Cke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Rke(t,"data",{signal:e.signal,highWaterMark:M3,highWatermark:M3});return Dke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},iP=Ike(!0),M3=iP,Dke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Nke({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*hp(a)}},Nke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as jke}from"node:timers/promises";var L3,Mke,Fke,Lke,oP,z3,sP=y(()=>{Qb();an();jI();$v();La();mp();L3=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=Mke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Fke(t),d]);return}let f=TI(c,r),p=nP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Lke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Mke=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=nP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await DK(a,t,r,o)},Fke=async t=>{await jke(),t.readableFlowing===null&&t.resume()},Lke=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 z3(_W({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},oP=async t=>{try{return await t}catch(e){return z3(e)}},z3=({bufferedData:t})=>uZ(t)?new Uint8Array(t):t});import{finished as zke}from"node:stream/promises";var bp,Uke,qke,Hke,Bke,Gke,aP,kv,U3,Ev=y(()=>{bp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Uke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],zke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Bke(a,e,r,n)}finally{s.abort()}},Uke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&qke(t,r,n),n},qke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Hke(e,r),n.call(t,...i)}},Hke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Bke=(t,e,r,n)=>{if(!Gke(t,e,r,n))throw t},Gke=(t,e,r,n=!0)=>r.propagating?U3(t)||kv(t):(r.propagating=!0,aP(r,e)===n?U3(t):kv(t)),aP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",U3=t=>t?.code==="EPIPE"});var q3,cP,lP=y(()=>{sP();Ev();q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>cP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),cP=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(aP(l,e)){await u;return}let[d]=await Promise.all([L3({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 H3,B3,Zke,Vke,uP=y(()=>{yv();lP();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>cP({...Zke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Vke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Zke=({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}},Vke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var G3,Z3,V3=y(()=>{Pl();ps();G3=t=>Il(t,"ipc"),Z3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var W3,K3,J3=y(()=>{La();V3();xo();qI();W3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=G3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of UI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(bW(t,i,c),i.push(l)),s&&Z3(l,o);return i},K3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Wke}from"node:events";var Y3,Kke,Jke,Yke,X3=y(()=>{Fa();nI();WR();rI();So();$r();sP();J3();oI();uP();lP();LI();Ev();Y3=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 _=UK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=W3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),T=Kke(h,t,S),D=Jke(m,S);try{return await Promise.race([Promise.all([{},HK(_),Promise.all(x),w,A,B9(t,d),...T,...D]),g,Yke(t,b),...L9(t,o,f,b),...o9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...M9({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=>oP(ae))),oP(w),K3(A,R),Promise.allSettled(T),Promise.allSettled(D)])}},Kke=(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:Cn.has(i),stopOnExit:i==="native"}))),Yke=async(t,{signal:e})=>{let[r]=await Wke(t,"error",{signal:e});throw r}});var Q3,vp,Zl,Av=y(()=>{Fl();Q3=()=>({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}},Zl=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 eJ}from"node:stream/promises";var dP,tJ,fP,pP,Tv,Ov,mP=y(()=>{Ev();dP=async t=>{if(t!==void 0)try{await fP(t)}catch{}},tJ=async t=>{if(t!==void 0)try{await pP(t)}catch{}},fP=async t=>{await eJ(t,{cleanup:!0,readable:!1,writable:!0})},pP=async t=>{await eJ(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 Xke}from"node:stream";import{callbackify as Qke}from"node:util";var rJ,hP,gP,yP,eEe,_P,bP,nJ,vP=y(()=>{ja();hs();$v();Fl();Av();mP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=hP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=gP(a,s),{read:f,onStdoutDataDone:p}=yP({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Xke({read:f,destroy:Qke(bP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return _P({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},hP=(t,e,r)=>{let n=Ll(t,e),i=vp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},gP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:iP},yP=({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(){eEe(this,s,o)},onStdoutDataDone:o}},eEe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},_P=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await pP(t),await n,await dP(i),await e,r.readable&&r.push(null)}catch(o){await dP(i),nJ(r,o)}},bP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Zl(r,e)&&(nJ(t,n),await Tv(e,n))},nJ=(t,e)=>{Ov(t,t.readable,e)}});import{Writable as tEe}from"node:stream";import{callbackify as iJ}from"node:util";var oJ,SP,wP,rEe,nEe,xP,$P,sJ,kP=y(()=>{hs();Av();mP();oJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=SP(t,r,e),s=new tEe({...wP(n,t,i),destroy:iJ($P.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return xP(n,s),s},SP=(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}},wP=(t,e,r)=>({write:rEe.bind(void 0,t),final:iJ(nEe.bind(void 0,t,e,r))}),rEe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},nEe=async(t,e,r)=>{await Zl(r,e)&&(t.writable&&t.end(),await e)},xP=async(t,e,r)=>{try{await fP(t),e.writable&&e.end()}catch(n){await tJ(r),sJ(e,n)}},$P=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Zl(r,e),await Zl(n,e)&&(sJ(t,i),await Tv(e,i))},sJ=(t,e)=>{Ov(t,t.writable,e)}});import{Duplex as iEe}from"node:stream";import{callbackify as oEe}from"node:util";var aJ,sEe,cJ=y(()=>{ja();vP();kP();aJ=({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}=hP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=SP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=gP(c,a),{read:g,onStdoutDataDone:b}=yP({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new iEe({read:g,...wP(u,t,d),destroy:oEe(sEe.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 _P({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),xP(u,_,c),_},sEe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([bP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),$P({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var EP,aEe,lJ=y(()=>{ja();hs();$v();EP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ll(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return aEe(a,s,t)},aEe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var uJ,dJ=y(()=>{Av();vP();kP();cJ();lJ();uJ=(t,{encoding:e})=>{let r=Q3();t.readable=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=oJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=aJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=EP.bind(void 0,t,e),t[Symbol.asyncIterator]=EP.bind(void 0,t,e,{})}});var fJ,cEe,lEe,pJ=y(()=>{fJ=(t,e)=>{for(let[r,n]of lEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},cEe=(async()=>{})().constructor.prototype,lEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(cEe,t)])});import{setMaxListeners as uEe}from"node:events";import{spawn as dEe}from"node:child_process";var mJ,fEe,pEe,mEe,hEe,gEe,hJ=y(()=>{Qb();DR();cI();hs();lI();HI();pp();rv();i3();l3();mp();b3();xb();$3();j3();uP();X3();dJ();Fl();pJ();mJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=fEe(t,e,r),{subprocess:f,promise:p}=mEe({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}),fJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},fEe=(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=pEe(l),d=c3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},pEe=({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}},mEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=dEe(...Bb(t,e,r))}catch(m){return n3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;uEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_3(c,a,l),x3(c,r,l);let d={},f=Di();c.kill=n9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),uJ(c,r),e3(c,r);let p=hEe({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}},hEe=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 Y3({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=gEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Hl(S,n,e)},gEe=({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,yEe,_Ee,gJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,yEe(n,t[n],i)]));return{...t,...r}},yEe=(t,e,r)=>_Ee.has(t)&&Ot(e)&&Ot(r)?{...e,...r}:r,_Ee=new Set(["env",...OR])});var _s,bEe,vEe,yJ=y(()=>{bo();$R();_Z();VK();hJ();gJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>bEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},bEe=({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}=vEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ZK(a,c,l):mJ(a,c,l,i)},vEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=gZ(e)?yZ(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 _J,bJ,vJ,SEe,wEe,SJ=y(()=>{_J=({file:t,commandArguments:e})=>vJ(t,e),bJ=({file:t,commandArguments:e})=>({...vJ(t,e),isSync:!0}),vJ=(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]=SEe(t);return{file:r,commandArguments:n}},SEe=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(wEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},wEe=/ +/g});var wJ,xJ,xEe,$J,$Ee,kJ,EJ=y(()=>{wJ=(t,e,r)=>{t.sync=e(xEe,r),t.s=t.sync},xJ=({options:t})=>$J(t),xEe=({options:t})=>({...$J(t),isSync:!0}),$J=t=>({options:{...$Ee(t),...t}}),$Ee=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kJ={preferLocal:!0}});var Ydt,Ke,Xdt,Qdt,eft,tft,rft,nft,ift,oft,zr=y(()=>{yJ();SJ();iI();EJ();HI();Ydt=_s(()=>({})),Ke=_s(()=>({isSync:!0})),Xdt=_s(_J),Qdt=_s(bJ),eft=_s(U9),tft=_s(xJ,{},kJ,wJ),{sendMessage:rft,getOneMessage:nft,getEachMessage:ift,getCancelSignal:oft}=t3()});import{existsSync as Iv,statSync as kEe}from"node:fs";import{dirname as AP,extname as EEe,isAbsolute as AJ,join as TP,relative as OP,resolve as Pv,sep as AEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function TEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function OEe(t,e){let n=OP(t,e).split(AEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function REe(t,e){let r=Pv(t,e),n=r;Iv(r)?kEe(r).isFile()&&(n=AP(r)):EEe(r)!==""&&(n=AP(r));let i=OP(t,n);if(i.startsWith("..")||AJ(i))return null;let o=n;for(;;){if(TEe(o))return o;if(Pv(o)===Pv(t))return null;let s=AP(o);if(s===o)return null;let a=OP(t,s);if(a.startsWith("..")||AJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=REe(r,o);if(!s){i.push(o);continue}let a=OEe(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 IP,readFileSync as IEe}from"node:fs";import{join as Vl}from"node:path";function Wl(t="."){let e=Vl(t,".cladding","config.yaml");if(!IP(e))return RP;try{let n=(0,TJ.parse)(IEe(e,"utf8"))?.gate;if(!n)return RP;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 PEe){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 RP}}function OJ(t="."){let e=Wl(t).testReport,r=e?[e,...PP]:PP;return[...new Set(r.map(n=>Vl(t,n)))]}function RJ(t="."){let e=Wl(t).testReport;if(e){let r=Vl(t,e);return IP(r)?r:null}return PP.map(r=>Vl(t,r)).find(r=>IP(r))??null}function IJ(t,e){let r=[],n=!1;for(let i of t){let o=CEe.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 TJ,PEe,RP,PP,CEe,Sp=y(()=>{"use strict";TJ=wt(tr(),1);Nv();PEe=["type","lint","test","coverage"],RP={scope:"feature"},PP=["test-report.junit.xml",Vl("coverage","junit.xml"),Vl(".cladding","test-report.junit.xml")];CEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as DP,readFileSync as PJ,readdirSync as DEe,statSync as NEe}from"node:fs";import{join as jv}from"node:path";function MP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(DP(r))try{if(CJ.test(PJ(r,"utf8")))return!0}catch{}}return!1}function DJ(t){try{return DP(t)&&CJ.test(PJ(t,"utf8"))}catch{return!1}}function NJ(t,e=0){if(e>4||!DP(t))return!1;let r;try{r=DEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=NEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DJ(i))return!0}return!1}function FEe(t){if(MP(t))return!0;for(let e of jEe)if(DJ(jv(t,e)))return!0;for(let e of MEe)if(NJ(jv(t,e)))return!0;return!1}function jJ(t="."){let e=Wl(t).coverage;return e||(FEe(t)?"kover":"jacoco")}function MJ(t="."){return NP[jJ(t)]}function FJ(t="."){return CP[jJ(t)]}var NP,CP,jP,CJ,jEe,MEe,Mv=y(()=>{"use strict";Sp();NP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},CP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},jP=[CP.kover,CP.jacoco],CJ=/kover/i;jEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],MEe=["buildSrc","build-logic"]});import{existsSync as xp,readFileSync as LP,readdirSync as zJ,statSync as LEe}from"node:fs";import{dirname as zEe,join as kr,resolve as UEe}from"node:path";import Kl from"node:process";function zP(t){return xp(kr(t,"gradlew"))?"./gradlew":"gradle"}function qEe(t){let e=zP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function HEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(LP(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 GEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function WEe(t,e){for(let r of e)if(xp(kr(t,r)))return r}function KEe(t,e){try{return zJ(t).find(n=>n.endsWith(e))}catch{return}}function QEe(t){let e=[],r=Kl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Kl.env.USERPROFILE:Kl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=UEe(t);;){e.push(kr(o,".madgerc"));let s=zEe(o);if(s===o)break;o=s}let i=Kl.env.MADGE_config??Kl.env.madge_config;return i&&e.push(i),e}function eAe(){for(let[t,e]of Object.entries(Kl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function UJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function rAe(t){try{return LEe(t).isFile()}catch{return!1}}function nAe(t){let e;try{e=LP(t,"utf8")}catch{return!0}try{return UJ(JSON.parse(e).excludeRegExp)}catch{return tAe.test(e)}}function iAe(t,e){let r=e.madge;return r&&typeof r=="object"&&UJ(r.excludeRegExp)||eAe()?!0:QEe(t).some(n=>rAe(n)&&nAe(n))}function oAe(t){try{return JSON.parse(LP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function wp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function LJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function sAe(t,e,r){if(iAe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",XEe),{...e,args:n}}function aAe(t,e,r){if(wp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of JEe)if(n.configs.some(i=>xp(kr(t,i))))return n.gate;if(YEe.some(n=>xp(kr(t,n)))||r.eslintConfig!==void 0)return e}function lAe(t,e){return cAe.some(r=>xp(kr(t,r)))?!0:e.jest!==void 0}function uAe(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 FP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function dAe(t,e){let r=oAe(t),n=e.lint?aAe(t,e.lint,r):void 0,i=e.arch?{...e,arch:sAe(t,e.arch,r)}:e,o=n?{...i,lint:n}:FP(i,"lint"),s=wp(r,"test"),a=s?uAe(s):void 0;return s&&!a?(o=FP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...wp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&lAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!wp(r,"coverage")&&!LJ(r,"@vitest/coverage-v8")&&!LJ(r,"@vitest/coverage-istanbul")?o=FP(o,"coverage"):a==="vitest"&&wp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of ZEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=KEe(t,o):r=WEe(t,[o]),r)break;if(!r||e.requiresSource&&!GEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?dAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return VEe}var Fi,BEe,ZEe,VEe,JEe,YEe,XEe,tAe,cAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];BEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);ZEe=[{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:qEe},{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:HEe}],VEe={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"]}}],YEe=["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"],XEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";tAe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;cAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as fAe,readFileSync as pAe}from"node:fs";import{join as mAe}from"node:path";function Ba(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(` + if (condition) { yield value; }`)}});import{Buffer as H0e}from"node:buffer";import{StringDecoder as B0e}from"node:string_decoder";var uv,G0e,Z0e,V0e,PI=y(()=>{an();uv=(t,e,r)=>{if(r)return;if(t)return{transform:G0e.bind(void 0,new TextEncoder)};let n=new B0e(e);return{transform:Z0e.bind(void 0,n),final:V0e.bind(void 0,n)}},G0e=function*(t,e){H0e.isBuffer(e)?yield vo(e):typeof e=="string"?yield t.encode(e):yield e},Z0e=function*(t,e){yield qt(e)?t.write(e):e},V0e=function*(t){let e=t.end();e!==""&&(yield e)}});import{callbackify as kK}from"node:util";var CI,dv,EK,W0e,AK,K0e,OK=y(()=>{CI=kK(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=K0e}=e[r];for await(let i of n(t))yield*dv(i,e,r+1)},EK=async function*(t){for(let[e,{final:r}]of Object.entries(t))yield*W0e(r,Number(e),t)},W0e=async function*(t,e,r){if(t!==void 0)for await(let n of t())yield*dv(n,r,e+1)},AK=kK(async({currentIterable:t},e)=>{if(t!==void 0){await(e?t.throw(e):t.return());return}if(e)throw e}),K0e=function*(t){yield t}});var DI,TK,Ua,hp,J0e,Y0e,NI=y(()=>{DI=(t,e,r,n)=>{try{for(let i of t(...e))r.push(i);n()}catch(i){n(i)}},TK=(t,e)=>[...e.flatMap(r=>[...Ua(r,t,0)]),...hp(t)],Ua=function*(t,e,r){if(r===e.length){yield t;return}let{transform:n=Y0e}=e[r];for(let i of n(t))yield*Ua(i,e,r+1)},hp=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)},Y0e=function*(t){yield t}});import{Transform as X0e,getDefaultHighWaterMark as RK}from"node:stream";var jI,fv,IK,pv=y(()=>{$r();lv();$K();PI();OK();NI();jI=({value:t,value:{transform:e,final:r,writableObjectMode:n,readableObjectMode:i},optionName:o},{encoding:s})=>{let a={},c=IK(t,s,o),l=za(e),u=za(r),d=l?CI.bind(void 0,dv,a):DI.bind(void 0,Ua),f=l||u?CI.bind(void 0,EK,a):DI.bind(void 0,hp),p=l||u?AK.bind(void 0,a):void 0;return{stream:new X0e({writableObjectMode:n,writableHighWaterMark:RK(n),readableObjectMode:i,readableHighWaterMark:RK(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=IK(s,r,a);t=TK(c,t)}return t},IK=({transform:t,final:e,binary:r,writableObjectMode:n,readableObjectMode:i,preserveNewlines:o},s,a)=>{let c={};return[{transform:SK(n,a)},uv(r,s,n),cv(r,o,n,c),{transform:t,final:e},{transform:wK(i,a)},vK({binary:r,preserveNewlines:o,readableObjectMode:i,state:c})].filter(Boolean)}});var PK,Q0e,e$e,t$e,r$e,CK=y(()=>{pv();an();$r();PK=(t,e)=>{for(let r of Q0e(t))e$e(t,r,e)},Q0e=t=>new Set(Object.entries(t).filter(([,{direction:e}])=>e==="input").map(([e])=>Number(e))),e$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=>t$e(a,n));r.input=Qf(s)},t$e=(t,e)=>{let r=fv(t,e,"utf8",!0);return r$e(r),Qf(r)},r$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,n$e,i$e,DK,NK,o$e,jK,MI=y(()=>{ja();$r();Pl();ps();mv=({stdioItems:t,encoding:e,verboseInfo:r,fdNumber:n})=>n!=="all"&&Il(r,n)&&!cn.has(e)&&n$e(n)&&(t.some(({type:i,value:o})=>i==="native"&&i$e.has(o))||t.every(({type:i})=>Cn.has(i))),n$e=t=>t===1||t===2,i$e=new Set(["pipe","overlapped"]),DK=async(t,e,r,n)=>{for await(let i of t)o$e(e)||jK(i,r,n)},NK=(t,e,r)=>{for(let n of t)jK(n,e,r)},o$e=t=>t._readableState.pipes.length>0,jK=(t,e,r)=>{let n=pb(t);Ci({type:"output",verboseMessage:n,fdNumber:e,verboseInfo:r})}});import{writeFileSync as s$e,appendFileSync as a$e}from"node:fs";var MK,c$e,l$e,u$e,d$e,f$e,FK=y(()=>{MI();pv();lv();an();$r();La();MK=({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)=>c$e({result:c,fileDescriptors:t,fdNumber:l,state:o,outputFiles:s,isMaxBuffer:n,verboseInfo:i},r)),...o}},c$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=wW(t,o,d),p=vo(f),{stdioItems:m,objectMode:h}=e[r],g=l$e([p],m,c,n),{serializedResult:b,finalResult:_=b}=u$e({chunks:g,objectMode:h,encoding:c,lines:l,stripFinalNewline:u,fdNumber:r});d$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&&f$e(b,m,i),S}catch(x){return n.error=x,S}},l$e=(t,e,r,n)=>{try{return fv(t,e,r,!1)}catch(i){return n.error=i,t}},u$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=fZ(t,r);return n[o]?{serializedResult:s,finalResult:II(s,!i[o],e)}:{serializedResult:s}},d$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=II(t,!1,s);try{NK(a,e,n)}catch(c){r.error??=c}},f$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)?a$e(n,t):(r.add(o),s$e(n,t))}}});var LK,zK=y(()=>{an();mp();LK=([,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)?ER([t,e]):`${t}${e}`}});import{once as FI}from"node:events";var UK,p$e,qK,HK,m$e,LI,zI=y(()=>{Da();UK=async(t,e)=>{let[r,n]=await p$e(t);return e.isForcefullyTerminated??=!1,[r,n]},p$e=async t=>{let[e,r]=await Promise.allSettled([FI(t,"spawn"),FI(t,"exit")]);return e.status==="rejected"?[]:r.status==="rejected"?qK(t):r.value},qK=async t=>{try{return await FI(t,"exit")}catch{return qK(t)}},HK=async t=>{let[e,r]=await t;if(!m$e(e,r)&&LI(e,r))throw new ni;return[e,r]},m$e=(t,e)=>t===void 0&&e===void 0,LI=(t,e)=>t!==0||e!==null});var BK,h$e,GK=y(()=>{Da();La();zI();BK=({error:t,status:e,signal:r,output:n},{maxBuffer:i})=>{let o=h$e(t,e,r),s=o?.code==="ETIMEDOUT",a=SW(o,n,i);return{resultError:o,exitCode:e,signal:r,timedOut:s,isMaxBuffer:a}},h$e=(t,e,r)=>t!==void 0?t:LI(e,r)?new ni:void 0});import{spawnSync as g$e}from"node:child_process";var ZK,y$e,_$e,b$e,hv,v$e,S$e,w$e,x$e,VK=y(()=>{NR();lI();uI();pp();rv();yK();mp();CK();FK();La();zK();GK();ZK=(t,e,r)=>{let{file:n,commandArguments:i,command:o,escapedCommand:s,startTime:a,verboseInfo:c,options:l,fileDescriptors:u}=y$e(t,e,r),d=v$e({file:n,commandArguments:i,options:l,command:o,escapedCommand:s,verboseInfo:c,fileDescriptors:u,startTime:a});return Hl(d,c,l)},y$e=(t,e,r)=>{let{command:n,escapedCommand:i,startTime:o,verboseInfo:s}=gb(t,e,r),a=_$e(r),{file:c,commandArguments:l,options:u}=Hb(t,e,a);b$e(u);let d=hK(u,s);return{file:c,commandArguments:l,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},_$e=t=>t.node&&!t.ipc?{...t,ipc:!1}:t,b$e=({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.`)},v$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,verboseInfo:o,fileDescriptors:s,startTime:a})=>{let c=S$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}=BK(c,r),{output:m,error:h=l}=MK({fileDescriptors:s,syncResult:c,options:r,isMaxBuffer:p,verboseInfo:o}),g=m.map((_,S)=>ko(_,r,S)),b=ko(LK(m,r),r,"all");return x$e({error:h,exitCode:u,signal:d,timedOut:f,isMaxBuffer:p,stdio:g,all:b,options:r,command:n,escapedCommand:i,startTime:a})},S$e=({file:t,commandArguments:e,options:r,command:n,escapedCommand:i,fileDescriptors:o,startTime:s})=>{try{PK(o,r);let a=w$e(r);return g$e(...Bb(t,e,a))}catch(a){return ql({error:a,command:n,escapedCommand:i,fileDescriptors:o,options:r,startTime:s,isSync:!0})}},w$e=({encoding:t,maxBuffer:e,...r})=>({...r,encoding:"buffer",maxBuffer:ev(e)}),x$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?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 UI,on as $$e}from"node:events";var WK,k$e,E$e,A$e,O$e,KK=y(()=>{Ml();ap();sp();WK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0,filter:o}={})=>(Nl({methodName:"getOneMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),k$e({anyProcess:t,channel:e,isSubprocess:r,filter:o,reference:i})),k$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([E$e(o,n,s),A$e(o,r,s),O$e(o,r,s)])}catch(a){throw jl(t),a}finally{s.abort(),Rb(e,i)}},E$e=async(t,e,{signal:r})=>{if(e===void 0){let[n]=await UI(t,"message",{signal:r});return n}for await(let[n]of $$e(t,"message",{signal:r}))if(e(n))return n},A$e=async(t,e,{signal:r})=>{await UI(t,"disconnect",{signal:r}),s9(e)},O$e=async(t,e,{signal:r})=>{let[n]=await UI(t,"strict:error",{signal:r});throw kb(n,e)}});import{once as YK,on as T$e}from"node:events";var XK,qI,R$e,I$e,P$e,JK,HI=y(()=>{Ml();ap();sp();XK=({anyProcess:t,channel:e,isSubprocess:r,ipc:n},{reference:i=!0}={})=>qI({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:!r,reference:i}),qI=({anyProcess:t,channel:e,isSubprocess:r,ipc:n,shouldAwait:i,reference:o})=>{Nl({methodName:"getEachMessage",isSubprocess:r,ipc:n,isConnected:jb(t)}),Tb(e,o);let s=gs(t,e,r),a=new AbortController,c={};return R$e(t,s,a),I$e({ipcEmitter:s,isSubprocess:r,controller:a,state:c}),P$e({anyProcess:t,channel:e,ipcEmitter:s,isSubprocess:r,shouldAwait:i,controller:a,state:c,reference:o})},R$e=async(t,e,r)=>{try{await YK(e,"disconnect",{signal:r.signal}),r.abort()}catch{}},I$e=async({ipcEmitter:t,isSubprocess:e,controller:r,state:n})=>{try{let[i]=await YK(t,"strict:error",{signal:r.signal});n.error=kb(i,e),r.abort()}catch{}},P$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 T$e(r,"message",{signal:o.signal}))JK(s),yield c}catch{JK(s)}finally{o.abort(),Rb(e,a),n||jl(t),i&&await t}},JK=({error:t})=>{if(t)throw t}});import QK from"node:process";var e3,t3,r3,BI=y(()=>{Ub();KK();HI();Db();e3=(t,{ipc:e})=>{Object.assign(t,r3(t,!1,e))},t3=()=>{let t=QK,e=!0,r=QK.channel!==void 0;return{...r3(t,e,r),getCancelSignal:D9.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})}},r3=(t,e,r)=>({sendMessage:zb.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getOneMessage:WK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r}),getEachMessage:XK.bind(void 0,{anyProcess:t,channel:t.channel,isSubprocess:e,ipc:r})})});import{ChildProcess as C$e}from"node:child_process";import{PassThrough as D$e,Readable as N$e,Writable as j$e,Duplex as M$e}from"node:stream";var n3,F$e,gp,L$e,z$e,U$e,q$e,i3=y(()=>{av();pp();rv();n3=({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,verboseInfo:s})=>{OI(n);let a=new C$e;F$e(a,n),Object.assign(a,{readable:L$e,writable:z$e,duplex:U$e});let c=ql({error:t,command:e,escapedCommand:r,fileDescriptors:n,options:i,startTime:o,isSync:!1}),l=q$e(c,s,i);return{subprocess:a,promise:l}},F$e=(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 D$e;return t.end(),t},L$e=()=>new N$e({read(){}}),z$e=()=>new j$e({write(){}}),U$e=()=>new M$e({read(){},write(){}}),q$e=async(t,e,r)=>Hl(t,e,r)});import{createReadStream as o3,createWriteStream as s3}from"node:fs";import{Buffer as H$e}from"node:buffer";import{Readable as yp,Writable as B$e,Duplex as G$e}from"node:stream";var c3,_p,a3,Z$e,l3=y(()=>{pv();av();$r();c3=(t,e)=>sv(Z$e,t,e,!1),_p=({type:t,optionName:e})=>{throw new TypeError(`The \`${e}\` option cannot be ${ys[t]}.`)},a3={fileNumber:_p,generator:jI,asyncGenerator:jI,nodeStream:({value:t})=>({stream:t}),webTransform({value:{transform:t,writableObjectMode:e,readableObjectMode:r}}){let n=e||r;return{stream:G$e.fromWeb(t,{objectMode:n})}},duplex:({value:{transform:t}})=>({stream:t}),native(){}},Z$e={input:{...a3,fileUrl:({value:t})=>({stream:o3(t)}),filePath:({value:{file:t}})=>({stream:o3(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(H$e.from(t))})},output:{...a3,fileUrl:({value:t})=>({stream:s3(t)}),filePath:({value:{file:t,append:e}})=>({stream:s3(t,e?{flags:"a"}:{})}),webStream:({value:t})=>({stream:B$e.fromWeb(t)}),iterable:_p,asyncIterable:_p,string:_p,uint8Array:_p}}});import{on as V$e,once as u3}from"node:events";import{PassThrough as W$e,getDefaultHighWaterMark as K$e}from"node:stream";import{finished as p3}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)ZI(i);let e=t.some(({readableObjectMode:i})=>i),r=J$e(t,e),n=new GI({objectMode:e,writableHighWaterMark:r,readableHighWaterMark:r});for(let i of t)n.add(i);return n}var J$e,GI,Y$e,X$e,Q$e,ZI,eke,tke,rke,nke,ike,m3,h3,VI,g3,oke,gv,d3,f3,yv=y(()=>{J$e=(t,e)=>{if(t.length===0)return K$e(e);let r=t.filter(({readableObjectMode:n})=>n===e).map(({readableHighWaterMark:n})=>n);return Math.max(...r)},GI=class extends W$e{#t=new Set([]);#r=new Set([]);#e=new Set([]);#n;#o=Symbol("unpipe");#i=new WeakMap;add(e){if(ZI(e),this.#t.has(e))return;this.#t.add(e),this.#n??=Y$e(this,this.#t,this.#o);let r=eke({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(ZI(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)}},Y$e=async(t,e,r)=>{gv(t,d3);let n=new AbortController;try{await Promise.race([X$e(t,n),Q$e(t,e,r,n)])}finally{n.abort(),gv(t,-d3)}},X$e=async(t,{signal:e})=>{try{await p3(t,{signal:e,cleanup:!0})}catch(r){throw m3(t,r),r}},Q$e=async(t,e,r,{signal:n})=>{for await(let[i]of V$e(t,"unpipe",{signal:n}))e.has(i)&&i.emit(r)},ZI=t=>{if(typeof t?.pipe!="function")throw new TypeError(`Expected a readable stream, got: \`${typeof t}\`.`)},eke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,onFinished:o,unpipeEvent:s})=>{gv(t,f3);let a=new AbortController;try{await Promise.race([tke(o,e,a),rke({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:a}),nke({stream:e,streams:r,ended:n,aborted:i,unpipeEvent:s,controller:a})])}finally{a.abort(),gv(t,-f3)}r.size>0&&r.size===n.size+i.size&&(n.size===0&&i.size>0?VI(t):ike(t))},tke=async(t,e,{signal:r})=>{try{await t,r.aborted||VI(e)}catch(n){r.aborted||m3(e,n)}},rke=async({passThroughStream:t,stream:e,streams:r,ended:n,aborted:i,controller:{signal:o}})=>{try{await p3(e,{signal:o,cleanup:!0,readable:!0,writable:!1}),r.has(e)&&n.add(e)}catch(s){if(o.aborted||!r.has(e))return;h3(s)?i.add(e):g3(t,s)}},nke=async({stream:t,streams:e,ended:r,aborted:n,unpipeEvent:i,controller:{signal:o}})=>{if(await u3(t,i,{signal:o}),!t.readable)return u3(o,"abort",{signal:o});e.delete(t),r.delete(t),n.delete(t)},ike=t=>{t.writable&&t.end()},m3=(t,e)=>{h3(e)?VI(t):g3(t,e)},h3=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",VI=t=>{(t.readable||t.writable)&&t.destroy()},g3=(t,e)=>{t.destroyed||(t.once("error",oke),t.destroy(e))},oke=()=>{},gv=(t,e)=>{let r=t.getMaxListeners();r!==0&&r!==Number.POSITIVE_INFINITY&&t.setMaxListeners(r+e)},d3=2,f3=1});import{finished as y3}from"node:stream/promises";var Gl,ske,WI,ake,KI,_v=y(()=>{So();Gl=(t,e)=>{t.pipe(e),ske(t,e),ake(t,e)},ske=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(t,{cleanup:!0,readable:!0,writable:!1})}catch{}WI(e)}},WI=t=>{t.writable&&t.end()},ake=async(t,e)=>{if(!(ri(t)||ri(e))){try{await y3(e,{cleanup:!0,readable:!1,writable:!0})}catch{}KI(t)}},KI=t=>{t.readable&&t.destroy()}});var _3,cke,lke,uke,dke,fke,b3=y(()=>{yv();So();Ob();$r();_v();_3=(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})=>Cn.has(c)))cke(t,a,s,i);for(let{stream:a}of o.filter(({type:c})=>!Cn.has(c)))uke({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);Gl(s,i)}},cke=(t,e,r,n)=>{r==="output"?Gl(t.stdio[n],e):Gl(e,t.stdio[n]);let i=lke[n];i!==void 0&&(t[i]=e),t.stdio[n]=e},lke=["stdin","stdout","stderr"],uke=({subprocess:t,stream:e,direction:r,fdNumber:n,pipeGroups:i,controller:o})=>{if(e===void 0)return;dke(e,o);let[s,a]=r==="output"?[e,t.stdio[n]]:[t.stdio[n],e],c=i.get(s)??[];i.set(s,[...c,a])},dke=(t,{signal:e})=>{ri(t)&&Na(t,fke,e)},fke=2});var Ha,v3=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 bv,JI,YI,pke,XI,vv,mke,QI,eP,tP,S3,flt,plt,w3=y(()=>{v3();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",JI=Symbol.for("signal-exit emitter"),YI=globalThis,pke=Object.defineProperty.bind(Object),XI=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(YI[JI])return YI[JI];pke(YI,JI,{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{},mke=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),QI=class extends vv{onExit(){return()=>{}}load(){}unload(){}},eP=class extends vv{#t=tP.platform==="win32"?"SIGINT":"SIGHUP";#r=new XI;#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(!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 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 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)}},tP=globalThis.process,{onExit:S3,load:flt,unload:plt}=mke(bv(tP)?new eP(tP):new QI)});import{addAbortListener as hke}from"node:events";var x3,$3=y(()=>{w3();x3=(t,{cleanup:e,detached:r},{signal:n})=>{if(!e||r)return;let i=S3(()=>{t.kill()});hke(n,()=>{i()})}});var E3,gke,yke,k3,_ke,A3=y(()=>{kR();hb();hs();Tl();E3=({source:t,sourcePromise:e,boundOptions:r,createNested:n},...i)=>{let o=mb(),{destination:s,destinationStream:a,destinationError:c,from:l,unpipeSignal:u}=gke(r,n,i),{sourceStream:d,sourceError:f}=_ke(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}},gke=(t,e,r)=>{try{let{destination:n,pipeOptions:{from:i,to:o,unpipeSignal:s}={}}=yke(t,e,...r),a=Ab(n,o);return{destination:n,destinationStream:a,from:i,unpipeSignal:s}}catch(n){return{destinationError:n}}},yke=(t,e,r,...n)=>{if(Array.isArray(r))return{destination:e(k3,t)(r,...n),pipeOptions:t};if(typeof r=="string"||r instanceof URL||xR(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(k3)(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}`)},k3=({options:t})=>({options:{...t,stdin:"pipe",piped:!0}}),_ke=(t,e)=>{try{return{sourceStream:Ll(t,e)}}catch(r){return{sourceError:r}}}});var T3,bke,rP,O3,nP=y(()=>{pp();_v();T3=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n,fileDescriptors:i,sourceOptions:o,startTime:s})=>{let a=bke({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n});if(a!==void 0)throw rP({error:a,fileDescriptors:i,sourceOptions:o,startTime:s})},bke=({sourceStream:t,sourceError:e,destinationStream:r,destinationError:n})=>{if(e!==void 0&&n!==void 0)return n;if(n!==void 0)return KI(t),n;if(e!==void 0)return WI(r),e},rP=({error:t,fileDescriptors:e,sourceOptions:r,startTime:n})=>ql({error:t,command:O3,escapedCommand:O3,fileDescriptors:e,options:r,startTime:n,isSync:!1}),O3="source.pipe(destination)"});var R3,I3=y(()=>{R3=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 vke}from"node:stream/promises";var P3,Ske,wke,xke,Sv,$ke,kke,C3=y(()=>{yv();Ob();_v();P3=(t,e,r)=>{let n=Sv.has(e)?wke(t,e):Ske(t,e);return Na(t,$ke,r.signal),Na(e,kke,r.signal),xke(e),n},Ske=(t,e)=>{let r=qa([t]);return Gl(r,e),Sv.set(e,r),r},wke=(t,e)=>{let r=Sv.get(e);return r.add(t),r},xke=async t=>{try{await vke(t,{cleanup:!0,readable:!1,writable:!0})}catch{}Sv.delete(t)},Sv=new WeakMap,$ke=2,kke=1});import{aborted as Eke}from"node:util";var D3,Ake,N3=y(()=>{nP();D3=(t,e)=>t===void 0?[]:[Ake(t,e)],Ake=async(t,{sourceStream:e,mergedStream:r,fileDescriptors:n,sourceOptions:i,startTime:o})=>{await Eke(t,e),await r.remove(e);let s=new Error("Pipe canceled by `unpipeSignal` option.");throw rP({error:s,fileDescriptors:n,sourceOptions:i,startTime:o})}});var wv,Oke,Tke,j3=y(()=>{bo();A3();nP();I3();C3();N3();wv=(t,...e)=>{if(Tt(e[0]))return wv.bind(void 0,{...t,boundOptions:{...t.boundOptions,...e[0]}});let{destination:r,...n}=E3(t,...e),i=Oke({...n,destination:r});return i.pipe=wv.bind(void 0,{...t,source:r,sourcePromise:i,boundOptions:{}}),i},Oke=async({sourcePromise:t,sourceStream:e,sourceOptions:r,sourceError:n,destination:i,destinationStream:o,destinationError:s,unpipeSignal:a,fileDescriptors:c,startTime:l})=>{let u=Tke(t,i);T3({sourceStream:e,sourceError:n,destinationStream:o,destinationError:s,fileDescriptors:c,sourceOptions:r,startTime:l});let d=new AbortController;try{let f=P3(e,o,d);return await Promise.race([R3(u),...D3(a,{sourceStream:e,mergedStream:f,sourceOptions:r,fileDescriptors:c,startTime:l})])}finally{d.abort()}},Tke=(t,e)=>Promise.allSettled([t,e])});import{on as Rke}from"node:events";import{getDefaultHighWaterMark as Ike}from"node:stream";var xv,Pke,iP,Cke,F3,oP,M3,Dke,Nke,$v=y(()=>{PI();lv();NI();xv=({subprocessStdout:t,subprocess:e,binary:r,shouldEncode:n,encoding:i,preserveNewlines:o})=>{let s=new AbortController;return Pke(e,s),F3({stream:t,controller:s,binary:r,shouldEncode:!t.readableObjectMode&&n,encoding:i,shouldSplit:!t.readableObjectMode,preserveNewlines:o})},Pke=async(t,e)=>{try{await t}catch{}finally{e.abort()}},iP=({stream:t,onStreamEnd:e,lines:r,encoding:n,stripFinalNewline:i,allMixed:o})=>{let s=new AbortController;Cke(e,s,t);let a=t.readableObjectMode&&!o;return F3({stream:t,controller:s,binary:n==="buffer",shouldEncode:!a,encoding:n,shouldSplit:!a&&r,preserveNewlines:!i})},Cke=async(t,e,r)=>{try{await t}catch{r.destroy()}finally{e.abort()}},F3=({stream:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})=>{let a=Rke(t,"data",{signal:e.signal,highWaterMark:M3,highWatermark:M3});return Dke({onStdoutChunk:a,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s})},oP=Ike(!0),M3=oP,Dke=async function*({onStdoutChunk:t,controller:e,binary:r,shouldEncode:n,encoding:i,shouldSplit:o,preserveNewlines:s}){let a=Nke({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*hp(a)}},Nke=({binary:t,shouldEncode:e,encoding:r,shouldSplit:n,preserveNewlines:i})=>[uv(t,r,!e),cv(t,i,!n,{})].filter(Boolean)});import{setImmediate as jke}from"node:timers/promises";var L3,Mke,Fke,Lke,sP,z3,aP=y(()=>{Qb();an();MI();$v();La();mp();L3=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=Mke({stream:t,onStreamEnd:e,fdNumber:r,encoding:n,allMixed:a,verboseInfo:l,streamInfo:u});if(!i){await Promise.all([Fke(t),d]);return}let f=TI(c,r),p=iP({stream:t,onStreamEnd:e,lines:s,encoding:n,stripFinalNewline:f,allMixed:a}),[m]=await Promise.all([Lke({stream:t,iterable:p,fdNumber:r,encoding:n,maxBuffer:o,lines:s}),d]);return m},Mke=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=iP({stream:t,onStreamEnd:e,lines:!0,encoding:n,stripFinalNewline:!0,allMixed:i});await DK(a,t,r,o)},Fke=async t=>{await jke(),t.readableFlowing===null&&t.resume()},Lke=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 z3(_W({error:a,stream:t,readableObjectMode:e,lines:s,encoding:i,fdNumber:n}))}},sP=async t=>{try{return await t}catch(e){return z3(e)}},z3=({bufferedData:t})=>uZ(t)?new Uint8Array(t):t});import{finished as zke}from"node:stream/promises";var bp,Uke,qke,Hke,Bke,Gke,cP,kv,U3,Ev=y(()=>{bp=async(t,e,r,{isSameDirection:n,stopOnExit:i=!1}={})=>{let o=Uke(t,r),s=new AbortController;try{await Promise.race([...i?[r.exitPromise]:[],zke(t,{cleanup:!0,signal:s.signal})])}catch(a){o.stdinCleanedUp||Bke(a,e,r,n)}finally{s.abort()}},Uke=(t,{originalStreams:[e],subprocess:r})=>{let n={stdinCleanedUp:!1};return t===e&&qke(t,r,n),n},qke=(t,e,r)=>{let{_destroy:n}=t;t._destroy=(...i)=>{Hke(e,r),n.call(t,...i)}},Hke=({exitCode:t,signalCode:e},r)=>{(t!==null||e!==null)&&(r.stdinCleanedUp=!0)},Bke=(t,e,r,n)=>{if(!Gke(t,e,r,n))throw t},Gke=(t,e,r,n=!0)=>r.propagating?U3(t)||kv(t):(r.propagating=!0,cP(r,e)===n?U3(t):kv(t)),cP=({fileDescriptors:t},e)=>e!=="all"&&t[e].direction==="input",kv=t=>t?.code==="ERR_STREAM_PREMATURE_CLOSE",U3=t=>t?.code==="EPIPE"});var q3,lP,uP=y(()=>{aP();Ev();q3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>t.stdio.map((c,l)=>lP({stream:c,fdNumber:l,encoding:e,buffer:r[l],maxBuffer:n[l],lines:i[l],allMixed:!1,stripFinalNewline:o,verboseInfo:s,streamInfo:a})),lP=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(cP(l,e)){await u;return}let[d]=await Promise.all([L3({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 H3,B3,Zke,Vke,dP=y(()=>{yv();uP();H3=({stdout:t,stderr:e},{all:r})=>r&&(t||e)?qa([t,e].filter(Boolean)):void 0,B3=({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:o,verboseInfo:s,streamInfo:a})=>lP({...Zke(t,r),fdNumber:"all",encoding:e,maxBuffer:n[1]+n[2],lines:i[1]||i[2],allMixed:Vke(t),stripFinalNewline:o,verboseInfo:s,streamInfo:a}),Zke=({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}},Vke=({all:t,stdout:e,stderr:r})=>t&&e&&r&&e.readableObjectMode!==r.readableObjectMode});var G3,Z3,V3=y(()=>{Pl();ps();G3=t=>Il(t,"ipc"),Z3=(t,e)=>{let r=pb(t);Ci({type:"ipc",verboseMessage:r,fdNumber:"ipc",verboseInfo:e})}});var W3,K3,J3=y(()=>{La();V3();xo();HI();W3=async({subprocess:t,buffer:e,maxBuffer:r,ipc:n,ipcOutput:i,verboseInfo:o})=>{if(!n)return i;let s=G3(o),a=wo(e,"ipc"),c=wo(r,"ipc");for await(let l of qI({anyProcess:t,channel:t.channel,isSubprocess:!1,ipc:n,shouldAwait:!1,reference:!0}))a&&(bW(t,i,c),i.push(l)),s&&Z3(l,o);return i},K3=async(t,e)=>(await Promise.allSettled([t]),e)});import{once as Wke}from"node:events";var Y3,Kke,Jke,Yke,X3=y(()=>{Fa();iI();KR();nI();So();$r();aP();J3();sI();dP();uP();zI();Ev();Y3=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 _=UK(t,f),S={originalStreams:h,fileDescriptors:m,subprocess:t,exitPromise:_,propagating:!1},x=q3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),w=B3({subprocess:t,encoding:e,buffer:r,maxBuffer:n,lines:i,stripFinalNewline:l,verboseInfo:p,streamInfo:S}),R=[],A=W3({subprocess:t,buffer:r,maxBuffer:n,ipc:u,ipcOutput:R,verboseInfo:p}),O=Kke(h,t,S),D=Jke(m,S);try{return await Promise.race([Promise.all([{},HK(_),Promise.all(x),w,A,B9(t,d),...O,...D]),g,Yke(t,b),...L9(t,o,f,b),...o9({subprocess:t,cancelSignal:s,gracefulCancel:a,context:f,controller:b}),...M9({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=>sP(ae))),sP(w),K3(A,R),Promise.allSettled(O),Promise.allSettled(D)])}},Kke=(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:Cn.has(i),stopOnExit:i==="native"}))),Yke=async(t,{signal:e})=>{let[r]=await Wke(t,"error",{signal:e});throw r}});var Q3,vp,Zl,Av=y(()=>{Fl();Q3=()=>({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}},Zl=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 eJ}from"node:stream/promises";var fP,tJ,pP,mP,Ov,Tv,hP=y(()=>{Ev();fP=async t=>{if(t!==void 0)try{await pP(t)}catch{}},tJ=async t=>{if(t!==void 0)try{await mP(t)}catch{}},pP=async t=>{await eJ(t,{cleanup:!0,readable:!1,writable:!0})},mP=async t=>{await eJ(t,{cleanup:!0,readable:!0,writable:!1})},Ov=async(t,e)=>{if(await t,e)throw e},Tv=(t,e,r)=>{r&&!kv(r)?t.destroy(r):e&&t.destroy()}});import{Readable as Xke}from"node:stream";import{callbackify as Qke}from"node:util";var rJ,gP,yP,_P,eEe,bP,vP,nJ,SP=y(()=>{ja();hs();$v();Fl();Av();hP();rJ=({subprocess:t,concurrentStreams:e,encoding:r},{from:n,binary:i=!0,preserveNewlines:o=!0}={})=>{let s=i||cn.has(r),{subprocessStdout:a,waitReadableDestroy:c}=gP(t,n,e),{readableEncoding:l,readableObjectMode:u,readableHighWaterMark:d}=yP(a,s),{read:f,onStdoutDataDone:p}=_P({subprocessStdout:a,subprocess:t,binary:s,encoding:r,preserveNewlines:o}),m=new Xke({read:f,destroy:Qke(vP.bind(void 0,{subprocessStdout:a,subprocess:t,waitReadableDestroy:c})),highWaterMark:d,objectMode:u,encoding:l});return bP({subprocessStdout:a,onStdoutDataDone:p,readable:m,subprocess:t}),m},gP=(t,e,r)=>{let n=Ll(t,e),i=vp(r,n,"readableDestroy");return{subprocessStdout:n,waitReadableDestroy:i}},yP=({readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r},n)=>n?{readableEncoding:t,readableObjectMode:e,readableHighWaterMark:r}:{readableEncoding:t,readableObjectMode:!0,readableHighWaterMark:oP},_P=({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(){eEe(this,s,o)},onStdoutDataDone:o}},eEe=async(t,e,r)=>{try{let{value:n,done:i}=await e.next();i?r.resolve():t.push(n)}catch{}},bP=async({subprocessStdout:t,onStdoutDataDone:e,readable:r,subprocess:n,subprocessStdin:i})=>{try{await mP(t),await n,await fP(i),await e,r.readable&&r.push(null)}catch(o){await fP(i),nJ(r,o)}},vP=async({subprocessStdout:t,subprocess:e,waitReadableDestroy:r},n)=>{await Zl(r,e)&&(nJ(t,n),await Ov(e,n))},nJ=(t,e)=>{Tv(t,t.readable,e)}});import{Writable as tEe}from"node:stream";import{callbackify as iJ}from"node:util";var oJ,wP,xP,rEe,nEe,$P,kP,sJ,EP=y(()=>{hs();Av();hP();oJ=({subprocess:t,concurrentStreams:e},{to:r}={})=>{let{subprocessStdin:n,waitWritableFinal:i,waitWritableDestroy:o}=wP(t,r,e),s=new tEe({...xP(n,t,i),destroy:iJ(kP.bind(void 0,{subprocessStdin:n,subprocess:t,waitWritableFinal:i,waitWritableDestroy:o})),highWaterMark:n.writableHighWaterMark,objectMode:n.writableObjectMode});return $P(n,s),s},wP=(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}},xP=(t,e,r)=>({write:rEe.bind(void 0,t),final:iJ(nEe.bind(void 0,t,e,r))}),rEe=(t,e,r,n)=>{t.write(e,r)?n():t.once("drain",n)},nEe=async(t,e,r)=>{await Zl(r,e)&&(t.writable&&t.end(),await e)},$P=async(t,e,r)=>{try{await pP(t),e.writable&&e.end()}catch(n){await tJ(r),sJ(e,n)}},kP=async({subprocessStdin:t,subprocess:e,waitWritableFinal:r,waitWritableDestroy:n},i)=>{await Zl(r,e),await Zl(n,e)&&(sJ(t,i),await Ov(e,i))},sJ=(t,e)=>{Tv(t,t.writable,e)}});import{Duplex as iEe}from"node:stream";import{callbackify as oEe}from"node:util";var aJ,sEe,cJ=y(()=>{ja();SP();EP();aJ=({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}=gP(t,n,e),{subprocessStdin:u,waitWritableFinal:d,waitWritableDestroy:f}=wP(t,i,e),{readableEncoding:p,readableObjectMode:m,readableHighWaterMark:h}=yP(c,a),{read:g,onStdoutDataDone:b}=_P({subprocessStdout:c,subprocess:t,binary:a,encoding:r,preserveNewlines:s}),_=new iEe({read:g,...xP(u,t,d),destroy:oEe(sEe.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 bP({subprocessStdout:c,onStdoutDataDone:b,readable:_,subprocess:t,subprocessStdin:u}),$P(u,_,c),_},sEe=async({subprocessStdout:t,subprocessStdin:e,subprocess:r,waitReadableDestroy:n,waitWritableFinal:i,waitWritableDestroy:o},s)=>{await Promise.all([vP({subprocessStdout:t,subprocess:r,waitReadableDestroy:n},s),kP({subprocessStdin:e,subprocess:r,waitWritableFinal:i,waitWritableDestroy:o},s)])}});var AP,aEe,lJ=y(()=>{ja();hs();$v();AP=(t,e,{from:r,binary:n=!1,preserveNewlines:i=!1}={})=>{let o=n||cn.has(e),s=Ll(t,r),a=xv({subprocessStdout:s,subprocess:t,binary:o,shouldEncode:!0,encoding:e,preserveNewlines:i});return aEe(a,s,t)},aEe=async function*(t,e,r){try{yield*t}finally{e.readable&&e.destroy(),await r}}});var uJ,dJ=y(()=>{Av();SP();EP();cJ();lJ();uJ=(t,{encoding:e})=>{let r=Q3();t.readable=rJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.writable=oJ.bind(void 0,{subprocess:t,concurrentStreams:r}),t.duplex=aJ.bind(void 0,{subprocess:t,concurrentStreams:r,encoding:e}),t.iterable=AP.bind(void 0,t,e),t[Symbol.asyncIterator]=AP.bind(void 0,t,e,{})}});var fJ,cEe,lEe,pJ=y(()=>{fJ=(t,e)=>{for(let[r,n]of lEe){let i=n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},cEe=(async()=>{})().constructor.prototype,lEe=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor(cEe,t)])});import{setMaxListeners as uEe}from"node:events";import{spawn as dEe}from"node:child_process";var mJ,fEe,pEe,mEe,hEe,gEe,hJ=y(()=>{Qb();NR();lI();hs();uI();BI();pp();rv();i3();l3();mp();b3();xb();$3();j3();dP();X3();dJ();Fl();pJ();mJ=(t,e,r,n)=>{let{file:i,commandArguments:o,command:s,escapedCommand:a,startTime:c,verboseInfo:l,options:u,fileDescriptors:d}=fEe(t,e,r),{subprocess:f,promise:p}=mEe({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}),fJ(f,p),Ni.set(f,{options:u,fileDescriptors:d}),f},fEe=(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=pEe(l),d=c3(u,s);return{file:a,commandArguments:c,command:n,escapedCommand:i,startTime:o,verboseInfo:s,options:u,fileDescriptors:d}},pEe=({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}},mEe=({file:t,commandArguments:e,options:r,startTime:n,verboseInfo:i,command:o,escapedCommand:s,fileDescriptors:a})=>{let c;try{c=dEe(...Bb(t,e,r))}catch(m){return n3({error:m,command:o,escapedCommand:s,fileDescriptors:a,options:r,startTime:n,verboseInfo:i})}let l=new AbortController;uEe(Number.POSITIVE_INFINITY,l.signal);let u=[...c.stdio];_3(c,a,l),x3(c,r,l);let d={},f=Di();c.kill=n9.bind(void 0,{kill:c.kill.bind(c),options:r,onInternalError:f,context:d,controller:l}),c.all=H3(c,r),uJ(c,r),e3(c,r);let p=hEe({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}},hEe=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 Y3({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=gEe({errorInfo:d,exitCode:f,signal:p,stdio:b,all:_,ipcOutput:g,context:c,options:e,command:s,escapedCommand:a,startTime:r});return Hl(S,n,e)},gEe=({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,yEe,_Ee,gJ=y(()=>{bo();xo();Rv=(t,e)=>{let r=Object.fromEntries(Object.entries(e).map(([n,i])=>[n,yEe(n,t[n],i)]));return{...t,...r}},yEe=(t,e,r)=>_Ee.has(t)&&Tt(e)&&Tt(r)?{...e,...r}:r,_Ee=new Set(["env",...RR])});var _s,bEe,vEe,yJ=y(()=>{bo();kR();_Z();VK();hJ();gJ();_s=(t,e,r,n)=>{let i=(s,a,c)=>_s(s,a,r,c),o=(...s)=>bEe({mapArguments:t,deepOptions:r,boundOptions:e,setBoundExeca:n,createNested:i},...s);return n!==void 0&&n(o,i,e),o},bEe=({mapArguments:t,deepOptions:e={},boundOptions:r={},setBoundExeca:n,createNested:i},o,...s)=>{if(Tt(o))return i(t,Rv(r,o),n);let{file:a,commandArguments:c,options:l,isSync:u}=vEe({mapArguments:t,firstArgument:o,nextArguments:s,deepOptions:e,boundOptions:r});return u?ZK(a,c,l):mJ(a,c,l,i)},vEe=({mapArguments:t,firstArgument:e,nextArguments:r,deepOptions:n,boundOptions:i})=>{let o=gZ(e)?yZ(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 _J,bJ,vJ,SEe,wEe,SJ=y(()=>{_J=({file:t,commandArguments:e})=>vJ(t,e),bJ=({file:t,commandArguments:e})=>({...vJ(t,e),isSync:!0}),vJ=(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]=SEe(t);return{file:r,commandArguments:n}},SEe=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(wEe)){let i=r.at(-1);i&&i.endsWith("\\")?r[r.length-1]=`${i.slice(0,-1)} ${n}`:r.push(n)}return r},wEe=/ +/g});var wJ,xJ,xEe,$J,$Ee,kJ,EJ=y(()=>{wJ=(t,e,r)=>{t.sync=e(xEe,r),t.s=t.sync},xJ=({options:t})=>$J(t),xEe=({options:t})=>({...$J(t),isSync:!0}),$J=t=>({options:{...$Ee(t),...t}}),$Ee=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},kJ={preferLocal:!0}});var rft,Ke,nft,ift,oft,sft,aft,cft,lft,uft,zr=y(()=>{yJ();SJ();oI();EJ();BI();rft=_s(()=>({})),Ke=_s(()=>({isSync:!0})),nft=_s(_J),ift=_s(bJ),oft=_s(U9),sft=_s(xJ,{},kJ,wJ),{sendMessage:aft,getOneMessage:cft,getEachMessage:lft,getCancelSignal:uft}=t3()});import{existsSync as Iv,statSync as kEe}from"node:fs";import{dirname as OP,extname as EEe,isAbsolute as AJ,join as TP,relative as RP,resolve as Pv,sep as AEe}from"node:path";function Cv(t){return t==="./gradlew"||t==="gradle"}function OEe(t){return(Iv(TP(t,"build.gradle.kts"))||Iv(TP(t,"build.gradle")))&&Iv(TP(t,"gradle.properties"))}function TEe(t,e){let n=RP(t,e).split(AEe).filter(Boolean);return n.length===0?":":`:${n.join(":")}`}function bs(t,e){return t===":"?`:${e}`:`${t}:${e}`}function REe(t,e){let r=Pv(t,e),n=r;Iv(r)?kEe(r).isFile()&&(n=OP(r)):EEe(r)!==""&&(n=OP(r));let i=RP(t,n);if(i.startsWith("..")||AJ(i))return null;let o=n;for(;;){if(OEe(o))return o;if(Pv(o)===Pv(t))return null;let s=OP(o);if(s===o)return null;let a=RP(t,s);if(a.startsWith("..")||AJ(a))return null;o=s}}function Dv(t,e){let r=Pv(t),n=new Map,i=[];for(let o of e){let s=REe(r,o);if(!s){i.push(o);continue}let a=TEe(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 PP,readFileSync as IEe}from"node:fs";import{join as Vl}from"node:path";function Wl(t="."){let e=Vl(t,".cladding","config.yaml");if(!PP(e))return IP;try{let n=(0,OJ.parse)(IEe(e,"utf8"))?.gate;if(!n)return IP;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 PEe){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 IP}}function TJ(t="."){let e=Wl(t).testReport,r=e?[e,...CP]:CP;return[...new Set(r.map(n=>Vl(t,n)))]}function RJ(t="."){let e=Wl(t).testReport;if(e){let r=Vl(t,e);return PP(r)?r:null}return CP.map(r=>Vl(t,r)).find(r=>PP(r))??null}function IJ(t,e){let r=[],n=!1;for(let i of t){let o=CEe.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 OJ,PEe,IP,CP,CEe,Sp=y(()=>{"use strict";OJ=wt(tr(),1);Nv();PEe=["type","lint","test","coverage"],IP={scope:"feature"},CP=["test-report.junit.xml",Vl("coverage","junit.xml"),Vl(".cladding","test-report.junit.xml")];CEe=/^\{modules:([A-Za-z0-9_.:-]+)\}$/});import{existsSync as NP,readFileSync as PJ,readdirSync as DEe,statSync as NEe}from"node:fs";import{join as jv}from"node:path";function FP(t){for(let e of["build.gradle.kts","build.gradle","gradle.properties"]){let r=jv(t,e);if(NP(r))try{if(CJ.test(PJ(r,"utf8")))return!0}catch{}}return!1}function DJ(t){try{return NP(t)&&CJ.test(PJ(t,"utf8"))}catch{return!1}}function NJ(t,e=0){if(e>4||!NP(t))return!1;let r;try{r=DEe(t)}catch{return!1}for(let n of r){let i=jv(t,n),o=!1;try{o=NEe(i).isDirectory()}catch{continue}if(o){if(n==="build"||n===".gradle"||n==="node_modules")continue;if(NJ(i,e+1))return!0}else if(/\.(kts|gradle|toml)$/.test(n)&&DJ(i))return!0}return!1}function FEe(t){if(FP(t))return!0;for(let e of jEe)if(DJ(jv(t,e)))return!0;for(let e of MEe)if(NJ(jv(t,e)))return!0;return!1}function jJ(t="."){let e=Wl(t).coverage;return e||(FEe(t)?"kover":"jacoco")}function MJ(t="."){return jP[jJ(t)]}function FJ(t="."){return DP[jJ(t)]}var jP,DP,MP,CJ,jEe,MEe,Mv=y(()=>{"use strict";Sp();jP={kover:"koverXmlReport",jacoco:"jacocoTestReport"},DP={kover:"build/reports/kover/report.xml",jacoco:"build/reports/jacoco/test/jacocoTestReport.xml"},MP=[DP.kover,DP.jacoco],CJ=/kover/i;jEe=["build.gradle.kts","build.gradle","settings.gradle.kts","settings.gradle","gradle/libs.versions.toml"],MEe=["buildSrc","build-logic"]});import{existsSync as xp,readFileSync as zP,readdirSync as zJ,statSync as LEe}from"node:fs";import{dirname as zEe,join as kr,resolve as UEe}from"node:path";import Kl from"node:process";function UP(t){return xp(kr(t,"gradlew"))?"./gradlew":"gradle"}function qEe(t){let e=UP(t);return{type:{cmd:e,args:["compileKotlin","compileTestKotlin"]},lint:{cmd:e,args:["ktlintCheck"]},test:{cmd:e,args:["test"]},coverage:{cmd:e,args:[MJ(t)]},secret:{cmd:"gitleaks",args:["detect","--no-banner"]}}}function HEe(t){let e=!1;try{e=/(^|\n)\s*flutter\s*:|sdk:\s*flutter/.test(zP(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 GEe(t,e){let r=[t],n=0,i=4e3;for(;r.length>0&&na.name.endsWith(c)))return!0}return!1}function WEe(t,e){for(let r of e)if(xp(kr(t,r)))return r}function KEe(t,e){try{return zJ(t).find(n=>n.endsWith(e))}catch{return}}function QEe(t){let e=[],r=Kl.platform==="win32";r||e.push(kr("/etc","madge","config"),kr("/etc","madgerc"));let n=r?Kl.env.USERPROFILE:Kl.env.HOME;n&&e.push(kr(n,".config","madge","config"),kr(n,".config","madge"),kr(n,".madge","config"),kr(n,".madgerc"));for(let o=UEe(t);;){e.push(kr(o,".madgerc"));let s=zEe(o);if(s===o)break;o=s}let i=Kl.env.MADGE_config??Kl.env.madge_config;return i&&e.push(i),e}function eAe(){for(let[t,e]of Object.entries(Kl.env))if(/^madge_excluderegexp/i.test(t)&&typeof e=="string"&&e.trim().length>0)return!0;return!1}function UJ(t){return Array.isArray(t)?t.length>0:typeof t=="string"&&t.trim().length>0}function rAe(t){try{return LEe(t).isFile()}catch{return!1}}function nAe(t){let e;try{e=zP(t,"utf8")}catch{return!0}try{return UJ(JSON.parse(e).excludeRegExp)}catch{return tAe.test(e)}}function iAe(t,e){let r=e.madge;return r&&typeof r=="object"&&UJ(r.excludeRegExp)||eAe()?!0:QEe(t).some(n=>rAe(n)&&nAe(n))}function oAe(t){try{return JSON.parse(zP(kr(t,"package.json"),"utf8").replace(/^\uFEFF/,""))}catch{return{}}}function wp(t,e){let r=t.scripts?.[e];return typeof r=="string"&&r.trim().length>0?r.trim():void 0}function LJ(t,e){return[t.dependencies,t.devDependencies,t.optionalDependencies,t.peerDependencies].some(r=>r?.[e]!==void 0)}function sAe(t,e,r){if(iAe(t,r))return e;let n=[...e.args];return n.splice(n.length-1,0,"--exclude",XEe),{...e,args:n}}function aAe(t,e,r){if(wp(r,"lint"))return{cmd:"npm",args:["run","--silent","lint"]};for(let n of JEe)if(n.configs.some(i=>xp(kr(t,i))))return n.gate;if(YEe.some(n=>xp(kr(t,n)))||r.eslintConfig!==void 0)return e}function lAe(t,e){return cAe.some(r=>xp(kr(t,r)))?!0:e.jest!==void 0}function uAe(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 LP(t,e){let r={...t};return e==="lint"?delete r.lint:delete r.coverage,r}function dAe(t,e){let r=oAe(t),n=e.lint?aAe(t,e.lint,r):void 0,i=e.arch?{...e,arch:sAe(t,e.arch,r)}:e,o=n?{...i,lint:n}:LP(i,"lint"),s=wp(r,"test"),a=s?uAe(s):void 0;return s&&!a?(o=LP(o,"coverage"),{...o,test:{cmd:"npm",args:["test"]},...wp(r,"coverage")?{coverage:{cmd:"npm",args:["run","--silent","coverage"]}}:{}}):a==="jest"||!s&&lAe(t,r)?{...o,test:{cmd:"npx",args:[...Fi,"jest"]},coverage:{cmd:"npx",args:[...Fi,"jest","--coverage"]}}:(a==="vitest"&&!wp(r,"coverage")&&!LJ(r,"@vitest/coverage-v8")&&!LJ(r,"@vitest/coverage-istanbul")?o=LP(o,"coverage"):a==="vitest"&&wp(r,"coverage")&&(o={...o,coverage:{cmd:"npm",args:["run","--silent","coverage"]}}),o)}function _t(t="."){for(let e of ZEe){let r;for(let o of e.manifests)if(o.startsWith(".")?r=KEe(t,o):r=WEe(t,[o]),r)break;if(!r||e.requiresSource&&!GEe(t,e.requiresSource))continue;let n=typeof e.gates=="function"?e.gates(t):e.gates,i=e.language==="typescript"?dAe(t,n):n;return{language:e.language,manifest:r,gates:i}}return VEe}var Fi,BEe,ZEe,VEe,JEe,YEe,XEe,tAe,cAe,Dn=y(()=>{"use strict";Mv();Fi=["--offline","--no-install"];BEe=new Set(["node_modules",".git",".gradle",".idea","build","target","dist","out",".cladding"]);ZEe=[{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:qEe},{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:HEe}],VEe={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"]}}],YEe=["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"],XEe="(^|/)(dist|coverage|\\.next|\\.nuxt|\\.output|\\.svelte-kit|\\.vite)/|^(build|out|target)/";tAe=/^[ \t]*excludeRegExp[ \t]*(?:\[[^\]]*\])?[ \t]*=[ \t]*(\S.*?)[ \t]*$/m;cAe=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs","jest.config.json"]});import{existsSync as fAe,readFileSync as pAe}from"node:fs";import{join as mAe}from"node:path";function Ba(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 qJ.test(o)||qJ.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??"")} ${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 Jl(t,e){let r=mAe(t,"package.json");if(!fAe(r))return!1;try{return!!JSON.parse(pAe(r,"utf8")).scripts?.[e]}catch{return!1}}var qJ,Nn=y(()=>{"use strict";qJ=/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 hAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:hAe}});function gAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:gAe}});import{existsSync as UP,readdirSync as HJ}from"node:fs";import{join as Hv}from"node:path";function _Ae(t,e){let r=Hv(t,e.path);if(!UP(r))return!0;if(e.isDirectory)try{return HJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function bAe(t){let{cwd:e="."}=t,r=[];for(let i of yAe)_Ae(e,i)&&r.push({detector:$p,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(UP(n)){let i=wAe(n),o=i?null:vAe(e);if(i)r.push({detector:$p,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:$p,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=SAe(e);s&&r.push({detector:$p,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 vAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!UP(r))continue;let n;try{n=HJ(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 SAe(t){try{return q(t),null}catch(e){return e.message}}function wAe(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 $p,yAe,BJ,GJ=y(()=>{"use strict";Ue();V_();$p="ABSENCE_OF_GOVERNANCE",yAe=[{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}];BJ={name:$p,run:bAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function qP(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=$Ae.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=xAe[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 kAe(t,e){let r=qP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function ZJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...kAe(r,n));return e}var xAe,$Ae,HP=y(()=>{"use strict";xAe={event:"when",state:"while",optional:"where",unwanted:"if"},$Ae=/\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 EAe(t){let{cwd:e="."}=t;return ye(e,Gv,AAe)}function AAe(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 ZJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,VJ,WJ=y(()=>{"use strict";HP();xt();Gv="AC_DRIFT";VJ={name:Gv,run:EAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return JJ[n]??KJ}var TAe,OAe,RAe,KJ,IAe,PAe,JJ,CAe,YJ,Va=y(()=>{"use strict";Dn();TAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,OAe=/^[ \t]*import\s+([\w.]+)/gm,RAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,KJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:TAe,importStyle:"relative"},IAe={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:OAe,importStyle:"dotted"},PAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:RAe,importStyle:"dotted"},JJ={typescript:KJ,kotlin:IAe,python:PAe},CAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],YJ=new Set([...Object.values(JJ).flatMap(t=>t?.extensions??[]),...CAe].map(t=>t.toLowerCase()))});import{existsSync as DAe,readFileSync as NAe,readdirSync as jAe,statSync as MAe}from"node:fs";import{join as QJ,relative as XJ}from"node:path";function FAe(t,e){if(!DAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=jAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=QJ(i,s),c;try{c=MAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function LAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function UAe(t){return zAe.test(t)}function qAe(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=>FAe(QJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=NAe(a,"utf8")}catch{continue}let l=c.split(` -`);for(let u=0;u{"use strict";Ue();Va();e8="AI_HINTS_FORBIDDEN_PATTERN";zAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;t8={name:e8,run:qAe}});function HAe(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:n8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var n8,i8,o8=y(()=>{"use strict";Ue();n8="AC_DUPLICATE_WITHIN_FEATURE";i8={name:n8,run:HAe}});import{createRequire as BAe}from"module";import{basename as GAe,dirname as GP,normalize as ZAe,relative as VAe,resolve as WAe,sep as c8}from"path";import*as KAe from"fs";function JAe(t){let e=ZAe(t);return e.length>1&&e[e.length-1]===c8&&(e=e.substring(0,e.length-1)),e}function l8(t,e){return t.replace(YAe,e)}function QAe(t){return t==="/"||XAe.test(t)}function BP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=WAe(t)),(n||o)&&(t=JAe(t)),t===".")return"";let s=t[t.length-1]!==i;return l8(s?t+i:t,i)}function u8(t,e){return e+t}function eTe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:l8(VAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function tTe(t){return t}function rTe(t,e,r){return e+t+r}function nTe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?eTe(t,e):n?u8:tTe}function iTe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function oTe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function lTe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?oTe(t):iTe(t):n&&n.length?aTe:sTe:cTe}function hTe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?mTe:r&&r.length?n?uTe:dTe:n?fTe:pTe}function _Te(t){return t.group?yTe:gTe}function STe(t){return t.group?bTe:vTe}function $Te(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?xTe:wTe}function d8(t,e,r){if(r.options.useRealPaths)return kTe(e,r);let n=GP(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=GP(n)}return r.symlinks.set(t,e),i>1}function kTe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function DTe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?ETe:RTe:n?e?ATe:CTe:i?e?OTe:PTe:e?TTe:ITe}function MTe(t){return t?jTe:NTe}function UTe(t,e){return new Promise((r,n)=>{m8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function m8(t,e,r){new p8(t,e,r).start()}function qTe(t,e){return new p8(t,e).start()}var s8,YAe,XAe,sTe,aTe,cTe,uTe,dTe,fTe,pTe,mTe,gTe,yTe,bTe,vTe,wTe,xTe,ETe,ATe,TTe,OTe,RTe,ITe,PTe,CTe,f8,NTe,jTe,FTe,LTe,zTe,p8,a8,h8,g8,y8=y(()=>{s8=BAe(import.meta.url);YAe=/[\\/]/g;XAe=/^[a-z]:[\\/]$/i;sTe=(t,e)=>{e.push(t||".")},aTe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},cTe=()=>{};uTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},dTe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},fTe=(t,e,r,n)=>{r.files++},pTe=(t,e)=>{e.push(t)},mTe=()=>{};gTe=t=>t,yTe=()=>[""].slice(0,0);bTe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},vTe=()=>{};wTe=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()&&d8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},xTe=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()&&d8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};ETe=t=>t.counts,ATe=t=>t.groups,TTe=t=>t.paths,OTe=t=>t.paths.slice(0,t.options.maxFiles),RTe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),ITe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),PTe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),CTe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);f8={withFileTypes:!0},NTe=(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||".",f8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},jTe=(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||".",f8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};FTe=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))}},LTe=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}},zTe=class{aborted=!1;abort(){this.aborted=!0}},p8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=DTe(e,this.isSynchronous),this.root=BP(t,e),this.state={root:QAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LTe,options:e,queue:new FTe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new zTe,fs:e.fs||KAe},this.joinPath=nTe(this.root,e),this.pushDirectory=lTe(this.root,e),this.pushFile=hTe(e),this.getArray=_Te(e),this.groupFiles=STe(e),this.resolveSymlink=$Te(e,this.isSynchronous),this.walkDirectory=MTe(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(_=BP(_,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=GAe(_),x=BP(GP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};a8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return UTe(this.root,this.options)}withCallback(t){m8(this.root,this.options,t)}sync(){return qTe(this.root,this.options)}},h8=null;try{s8.resolve("picomatch"),h8=s8("picomatch")}catch{}g8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:c8,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 a8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new a8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||h8;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 kp=v((lpt,w8)=>{"use strict";var _8="[^\\\\/]",HTe="(?=.)",b8="[^/]",ZP="(?:\\/|$)",v8="(?:^|\\/)",VP=`\\.{1,2}${ZP}`,BTe="(?!\\.)",GTe=`(?!${v8}${VP})`,ZTe=`(?!\\.{0,1}${ZP})`,VTe=`(?!${VP})`,WTe="[^.\\/]",KTe=`${b8}*?`,JTe="/",S8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:HTe,QMARK:b8,END_ANCHOR:ZP,DOTS_SLASH:VP,NO_DOT:BTe,NO_DOTS:GTe,NO_DOT_SLASH:ZTe,NO_DOTS_SLASH:VTe,QMARK_NO_DOT:WTe,STAR:KTe,START_ANCHOR:v8,SEP:JTe},YTe={...S8,SLASH_LITERAL:"[\\\\/]",QMARK:_8,STAR:`${_8}*?`,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:"\\"},XTe={__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"};w8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:XTe,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?YTe:S8}}});var Ep=v(Ur=>{"use strict";var{REGEX_BACKSLASH:QTe,REGEX_REMOVE_BACKSLASH:eOe,REGEX_SPECIAL_CHARS:tOe,REGEX_SPECIAL_CHARS_GLOBAL:rOe}=kp();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>tOe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(rOe,"\\$1");Ur.toPosixSlashes=t=>t.replace(QTe,"/");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(eOe,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 R8=v((dpt,O8)=>{"use strict";var x8=Ep(),{CHAR_ASTERISK:WP,CHAR_AT:nOe,CHAR_BACKWARD_SLASH:Ap,CHAR_COMMA:iOe,CHAR_DOT:KP,CHAR_EXCLAMATION_MARK:JP,CHAR_FORWARD_SLASH:T8,CHAR_LEFT_CURLY_BRACE:YP,CHAR_LEFT_PARENTHESES:XP,CHAR_LEFT_SQUARE_BRACKET:oOe,CHAR_PLUS:sOe,CHAR_QUESTION_MARK:$8,CHAR_RIGHT_CURLY_BRACE:aOe,CHAR_RIGHT_PARENTHESES:k8,CHAR_RIGHT_SQUARE_BRACKET:cOe}=kp(),E8=t=>t===T8||t===Ap,A8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},lOe=(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&&E8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=x8.removeBackslashes(C)),J&&_===!0&&(J=x8.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,E8(T)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Tp=kp(),ln=Ep(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:uOe,REGEX_NON_SPECIAL_CHARS:dOe,REGEX_SPECIAL_CHARS_BACKREF:fOe,REPLACEMENTS:I8}=Tp,pOe=(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=>ln.escapeRegex(i)).join("..")}return r},Yl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,P8=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},mOe=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},eC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(mOe(e))return e.replace(/\\(.)/g,"$1")},hOe=t=>{let e=t.map(eC).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}}}}},gOe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,yOe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=eC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},_Oe=t=>{let e=0,r=t.trim(),n=QP(r);for(;n;)e++,r=n.body.trim(),n=QP(r);return e},bOe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Tp.DEFAULT_MAX_EXTGLOB_RECURSION,n=P8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||hOe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=yOe(a);if(c){o=!0,i.push(...c);continue}let l=eC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,_Oe(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:gOe([...new Set(i)])}:{risky:!0}:{risky:!1}},tC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=I8[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=Tp.globChars(r.windows),l=Tp.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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],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:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Oe}),ae.push(B)},Nfe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Oe=bOe(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=ht,Ei.output=ut||ln.escapeRegex(ht);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=tC(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,ht=t.replace(fOe,(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?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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=uOe[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=ln.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(Yl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Nfe(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(Yl("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(Yl("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||ln.hasRegexChars(B))continue;let Oe=ln.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=pOe(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=dOe.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","}"));E.output=ln.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};tC.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=I8[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}=Tp.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=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};C8.exports=tC});var M8=v((ppt,j8)=>{"use strict";var vOe=R8(),rC=D8(),N8=Ep(),SOe=kp(),wOe=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=wOe(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?N8.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(N8.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)):rC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>vOe(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=rC.fastpaths(t,e)),i.output||(i=rC(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=SOe;j8.exports=Rt});var U8=v((mpt,z8)=>{"use strict";var F8=M8(),xOe=Ep();function L8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:xOe.isWindows()}),F8(t,e,r)}Object.assign(L8,F8);z8.exports=L8});import{readdir as $Oe,readdirSync as kOe,realpath as EOe,realpathSync as AOe,stat as TOe,statSync as OOe}from"fs";import{isAbsolute as ROe,posix as Wa,resolve as IOe}from"path";import{fileURLToPath as POe}from"url";function jOe(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]===".."&&NOe.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 LOe(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 H8(t){return t.replace(DOe,e=>`${e}/`)}function V8(t){var e;let r=Xl.default.scan(t,zOe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZOe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Xl.default.scan(t);return r.isGlob||r.negated}function Op(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function W8(t){return typeof t=="string"?[t]:t??[]}function nC(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=GOe(o);s=ROe(s.replace(WOe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=VOe.exec(s))===null||i===void 0?void 0:i[0],l=V8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=H8(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 KOe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(nC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(nC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(nC(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=KOe(t,e,n);t.debug&&Op("internal processing patterns:",i);let{absolute:o,caseSensitiveMatch:s,debug:a,dot:c,followSymbolicLinks:l,onlyDirectories:u}=t,d=n.root.replace(G8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Xl.default)(i.match,f),m=(0,Xl.default)(i.ignore,f),h=jOe(i.match,f),g=q8(r,d,o),b=o?g:q8(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 g8({filters:[a?(w,R)=>{let A=g(w,R),T=p(A)&&!m(A);return T&&Op(`matched ${A}`),T}:(w,R)=>{let A=g(w,R);return p(A)&&!m(A)}],exclude:a?(w,R)=>{let A=_(w,R);return Op(`${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&&Op("internal properties:",{...n,root:d}),[x,r!==d&&!o&&LOe(r,d)]}function YOe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function XOe(t){let e=Object.assign({},t);for(let r in B8)e[r]===void 0&&Object.assign(e,{[r]:B8[r]});return e.cwd=(e.cwd instanceof URL?POe(e.cwd):IOe(e.cwd||process.cwd())).replace(G8,"/"),e.ignore=W8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||$Oe,readdirSync:e.fs.readdirSync||kOe,realpath:e.fs.realpath||EOe,realpathSync:e.fs.realpathSync||AOe,stat:e.fs.stat||TOe,statSync:e.fs.statSync||OOe}),e.debug&&Op("globbing with options:",e),e}function QOe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=COe(t)||typeof t=="string",i=W8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=XOe(n?e:t);return i.length>0?JOe(o,i):[]}function vs(t,e){let[r,n]=QOe(t,e);return r?YOe(r.sync(),n):[]}var Xl,COe,G8,DOe,Z8,NOe,MOe,FOe,zOe,UOe,qOe,HOe,BOe,GOe,VOe,WOe,B8,Rp=y(()=>{y8();Xl=wt(U8(),1),COe=Array.isArray,G8=/\\/g,DOe=/^[A-Za-z]:$/,Z8=process.platform==="win32",NOe=/^(\/?\.\.)+$/;MOe=/^[A-Z]:\/$/i,FOe=Z8?t=>MOe.test(t):t=>t==="/";zOe={parts:!0};UOe=/(?t.replace(UOe,"\\$&"),BOe=t=>t.replace(qOe,"\\$&"),GOe=Z8?BOe:HOe;VOe=/^(\/?\.\.)+/,WOe=/\\(?=[()[\]{}!*+?@|])/g;B8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Ip,readFileSync as eRe,readdirSync as tRe,statSync as K8}from"node:fs";import{join as Ka}from"node:path";function rRe(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}=iC(r);return(s.size>0||a.length>0)&&!Ip(Ka(e,i.mainRoot))?[{detector:Pp,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&&(nRe(e,i,s,o),iRe(e,i,s,o)),a.length>0&&oRe(e,i,a,o),o)}function iC(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 nRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of tRe(o)){let a=Ka(o,s);K8(a).isDirectory()&&(r.has(s)||n.push({detector:Pp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function iRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of r){let a=Ka(o,s);Ip(a)&&K8(a).isDirectory()||n.push({detector:Pp,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 oRe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Ip(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=eRe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];sRe(p,s.to,e.importStyle)&&n.push({detector:Pp,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 sRe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Pp,J8,oC=y(()=>{"use strict";Rp();Ue();Va();Pp="ARCHITECTURE_FROM_SPEC";J8={name:Pp,run:rRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t,r=lRe(e,"spec/capabilities.yaml");if(!aRe(r))return[];let n;try{let u=cRe(r,"utf8"),d=Y8.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";Y8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",uRe=8;X8={name:Wv,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function hRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function gRe(t){let{cwd:e="."}=t;return ye(e,sC,r=>yRe(r,e))}function yRe(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=mRe(e,o);if(!fRe(s))continue;let a=pRe(s,"utf8");hRe(a)||n.push({detector:sC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var sC,e5,t5=y(()=>{"use strict";Va();xt();sC="CONVENTION_DRIFT";e5={name:sC,run:gRe}});import{existsSync as aC,readFileSync as r5}from"node:fs";import{join as Kv}from"node:path";function _Re(t){return JSON.parse(t).total?.lines?.pct??0}function n5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function SRe(t,e){if(!Cv(_t(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=jP.find(d=>aC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=n5(r5(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=i5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function wRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=SRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?jP.find(a=>aC(Kv(e,a)))??FJ(e):n.coverageSummary,o=Kv(e,i);if(!aC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=r5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?bRe(a):n.coverageFormat==="cobertura-xml"?vRe(a):_Re(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,o5,s5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;o5={name:Eo,run:wRe}});import{existsSync as xRe}from"node:fs";import{join as $Re}from"node:path";function ERe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>ARe(r,e))}function ARe(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",kRe=8;a5={name:Yv,run:ERe}});function TRe(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 ORe(t){let e=TRe(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 RRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>ORe(r))}var Xv,l5,u5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";l5={name:Xv,run:RRe}});function IRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>PRe(r,e))}function PRe(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,cC=y(()=>{"use strict";El();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:IRe}});function CRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return DRe(r)}function DRe(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:d5,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 d5,tS,lC=y(()=>{"use strict";Ue();d5="DEPENDENCY_CYCLE";tS={name:d5,run:CRe}});import{appendFileSync as NRe,existsSync as f5,mkdirSync as jRe,readFileSync as MRe}from"node:fs";import{dirname as FRe,join as LRe}from"node:path";function p5(t){return LRe(t,zRe,URe)}function m5(t){return uC.add(t),()=>uC.delete(t)}function Ja(t,e){let r=p5(t),n=FRe(r);f5(n)||jRe(n,{recursive:!0}),NRe(r,`${JSON.stringify(e)} -`,"utf8");for(let i of uC)try{i(t,e)}catch{}}function pr(t){let e=p5(t);if(!f5(e))return[];let r=MRe(e,"utf8").trim();return r.length===0?[]:r.split(` -`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var zRe,URe,uC,un=y(()=>{"use strict";zRe=".cladding",URe="audit.log.jsonl";uC=new Set});import{existsSync as qRe}from"node:fs";import{join as HRe}from"node:path";function BRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:dC,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&&(qRe(HRe(e,i.artifact))||n.push({detector:dC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var dC,h5,g5=y(()=>{"use strict";un();dC="EVIDENCE_MISMATCH";h5={name:dC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function WRe(t){let e=VRe(t,v5);if(!GRe(e))return null;try{let n=((0,b5.parse)(ZRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*_5(t,e){for(let r of t??[])r.startsWith(y5)&&(yield{ref:r,name:r.slice(y5.length),field:e})}function KRe(t){let{cwd:e="."}=t,r=WRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:fC,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=[..._5(s.evidence_refs,"evidence_refs"),..._5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:fC,severity:"warn",path:v5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var b5,fC,y5,v5,S5,w5=y(()=>{"use strict";b5=wt(tr(),1);Ue();fC="FIXTURE_REFERENCE_INVALID",y5="fixture:",v5="conformance/fixtures.yaml";S5={name:fC,run:KRe}});import{existsSync as Ql,readFileSync as pC}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 Cp(t){if(!Ql(t))return null;try{return JSON.parse(pC(t,"utf8"))}catch{return null}}function YRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(pC(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 XRe(t,e){for(let r of x5){let n=Ya(t,r.path);if(!Ql(n))continue;let i=Cp(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 QRe(t,e){let r=Cp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of x5){let s=Ya(t,o.path);if(!Ql(s))continue;let a=Cp(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(Ql(i)){let o=Cp(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 eIe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function tIe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Ql(r)||!Ql(n))return;let i=eIe(pC(r,"utf8"));if(i.length===0)return;let s=Cp(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 rIe(t){let{cwd:e="."}=t,r=[];return YRe(e,r),tIe(e,r),XRe(e,r),QRe(e,r),r}var Ao,x5,$5,k5=y(()=>{"use strict";Rp();Ao="HARNESS_INTEGRITY",x5=[{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"]}];$5={name:Ao,run:rIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function aIe(t){let{cwd:e="."}=t;return ye(e,rS,r=>lIe(r,e))}function cIe(t){let e=oIe(t,"spec/capabilities.yaml");if(!nIe(e))return!1;try{let r=E5.default.parse(iIe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function lIe(t,e){let r=t.features.length;if(r{"use strict";E5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",sIe=8;A5={name:rS,run:aIe}});function uIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function dIe(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+=` +`);return n?{stage:t,pass:!1,exitCode:1,stderr:n}:{stage:t,pass:!1,exitCode:1}}function Jl(t,e){let r=mAe(t,"package.json");if(!fAe(r))return!1;try{return!!JSON.parse(pAe(r,"utf8")).scripts?.[e]}catch{return!1}}var qJ,Nn=y(()=>{"use strict";qJ=/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 hAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Ga,zv=y(()=>{"use strict";zr();Dn();Nn();Lv="ARCHITECTURE_VIOLATION";Ga={name:Lv,subprocess:!0,run:hAe}});function gAe(t){let{cwd:e="."}=t,r=_t(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 Ba(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,Za,qv=y(()=>{"use strict";zr();Dn();Nn();Uv="HARDCODED_SECRET";Za={name:Uv,subprocess:!0,run:gAe}});import{existsSync as qP,readdirSync as HJ}from"node:fs";import{join as Hv}from"node:path";function _Ae(t,e){let r=Hv(t,e.path);if(!qP(r))return!0;if(e.isDirectory)try{return HJ(r).filter(i=>i.endsWith(".yaml")||i.endsWith(".yml")).length===0}catch{return!0}return!1}function bAe(t){let{cwd:e="."}=t,r=[];for(let i of yAe)_Ae(e,i)&&r.push({detector:$p,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(qP(n)){let i=wAe(n),o=i?null:vAe(e);if(i)r.push({detector:$p,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:$p,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=SAe(e);s&&r.push({detector:$p,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 vAe(t){for(let e of["spec/features","spec/scenarios"]){let r=Hv(t,e);if(!qP(r))continue;let n;try{n=HJ(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 SAe(t){try{return q(t),null}catch(e){return e.message}}function wAe(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 $p,yAe,BJ,GJ=y(()=>{"use strict";Ue();V_();$p="ABSENCE_OF_GOVERNANCE",yAe=[{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}];BJ={name:$p,run:bAe}});function Bv(t){let e=t.trim().match(/^(\S+)/);return e?e[1].toLowerCase():""}function HP(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=$Ae.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=xAe[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 kAe(t,e){let r=HP(e.ears,e.condition);return r?[{featureId:t.id,acId:e.id,pattern:e.ears??"unspecified",message:r}]:[]}function ZJ(t){let e=[];for(let r of t)for(let n of r.acceptance_criteria??[])e.push(...kAe(r,n));return e}var xAe,$Ae,BP=y(()=>{"use strict";xAe={event:"when",state:"while",optional:"where",unwanted:"if"},$Ae=/\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 EAe(t){let{cwd:e="."}=t;return ye(e,Gv,AAe)}function AAe(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 ZJ(t.features))e.push({detector:Gv,severity:"error",message:`${r.featureId}.${r.acId} EARS: ${r.message}`});return e}var Gv,VJ,WJ=y(()=>{"use strict";BP();xt();Gv="AC_DRIFT";VJ={name:Gv,run:EAe}});function Li(t=".",e){let n=(e??"").trim().toLowerCase()||_t(t).language;return JJ[n]??KJ}var OAe,TAe,RAe,KJ,IAe,PAe,JJ,CAe,YJ,Va=y(()=>{"use strict";Dn();OAe=/(?:import\s+(?:[\s\S]*?\sfrom\s+)?|import\s*\()['"]([^'"]+)['"]\)?/g,TAe=/^[ \t]*import\s+([\w.]+)/gm,RAe=/^[ \t]*(?:from|import)\s+([\w.]+)/gm,KJ={ext:"ts",extensions:[".ts",".tsx"],sourceRoots:["src"],mainRoot:"src",testGlobs:["tests/**/*.test.ts"],coverageSummary:"coverage/coverage-summary.json",coverageFormat:"istanbul-json",importMatcher:OAe,importStyle:"relative"},IAe={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:TAe,importStyle:"dotted"},PAe={ext:"py",extensions:[".py"],sourceRoots:["."],mainRoot:"src",testGlobs:["tests/test_*.py","tests/**/test_*.py","tests/**/*_test.py"],coverageSummary:"coverage.xml",coverageFormat:"cobertura-xml",importMatcher:RAe,importStyle:"dotted"},JJ={typescript:KJ,kotlin:IAe,python:PAe},CAe=[".js",".jsx",".mts",".cts",".rs",".go",".java",".rb",".php",".cs",".fs",".ex",".exs"],YJ=new Set([...Object.values(JJ).flatMap(t=>t?.extensions??[]),...CAe].map(t=>t.toLowerCase()))});import{existsSync as DAe,readFileSync as NAe,readdirSync as jAe,statSync as MAe}from"node:fs";import{join as QJ,relative as XJ}from"node:path";function FAe(t,e){if(!DAe(t))return[];let r=[],n=[t];for(;n.length>0;){let i=n.pop(),o;try{o=jAe(i)}catch{continue}for(let s of o){if(s==="node_modules"||s===".cladding"||s.startsWith("."))continue;let a=QJ(i,s),c;try{c=MAe(a)}catch{continue}c.isDirectory()?n.push(a):e.some(l=>s.endsWith(l))&&r.push(a)}}return r}function LAe(t){let e=t.trim();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("*")}function UAe(t){return zAe.test(t)}function qAe(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=>FAe(QJ(e,a),i.extensions));if(o.length===0)return[];let s=[];for(let a of o){let c;try{c=NAe(a,"utf8")}catch{continue}let l=c.split(` +`);for(let u=0;u{"use strict";Ue();Va();e8="AI_HINTS_FORBIDDEN_PATTERN";zAe=/\/\/\s*cladding-disable[:\s]+AI_HINTS_FORBIDDEN_PATTERN\b/;t8={name:e8,run:qAe}});function HAe(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:n8,severity:"error",message:`${i.id}.${a} appears ${c} times \u2014 AC ids must be unique within a feature`})}return n}var n8,i8,o8=y(()=>{"use strict";Ue();n8="AC_DUPLICATE_WITHIN_FEATURE";i8={name:n8,run:HAe}});import{createRequire as BAe}from"module";import{basename as GAe,dirname as ZP,normalize as ZAe,relative as VAe,resolve as WAe,sep as c8}from"path";import*as KAe from"fs";function JAe(t){let e=ZAe(t);return e.length>1&&e[e.length-1]===c8&&(e=e.substring(0,e.length-1)),e}function l8(t,e){return t.replace(YAe,e)}function QAe(t){return t==="/"||XAe.test(t)}function GP(t,e){let{resolvePaths:r,normalizePath:n,pathSeparator:i}=e,o=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(r&&(t=WAe(t)),(n||o)&&(t=JAe(t)),t===".")return"";let s=t[t.length-1]!==i;return l8(s?t+i:t,i)}function u8(t,e){return e+t}function eOe(t,e){return function(r,n){return n.startsWith(t)?n.slice(t.length)+r:l8(VAe(t,n),e.pathSeparator)+e.pathSeparator+r}}function tOe(t){return t}function rOe(t,e,r){return e+t+r}function nOe(t,e){let{relativePaths:r,includeBasePath:n}=e;return r&&t?eOe(t,e):n?u8:tOe}function iOe(t){return function(e,r){r.push(e.substring(t.length)||".")}}function oOe(t){return function(e,r,n){let i=e.substring(t.length)||".";n.every(o=>o(i,!0))&&r.push(i)}}function lOe(t,e){let{includeDirs:r,filters:n,relativePaths:i}=e;return r?i?n&&n.length?oOe(t):iOe(t):n&&n.length?aOe:sOe:cOe}function hOe(t){let{excludeFiles:e,filters:r,onlyCounts:n}=t;return e?mOe:r&&r.length?n?uOe:dOe:n?fOe:pOe}function _Oe(t){return t.group?yOe:gOe}function SOe(t){return t.group?bOe:vOe}function $Oe(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?xOe:wOe}function d8(t,e,r){if(r.options.useRealPaths)return kOe(e,r);let n=ZP(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=ZP(n)}return r.symlinks.set(t,e),i>1}function kOe(t,e){return e.visited.includes(t+e.options.pathSeparator)}function Zv(t,e,r,n){e(t&&!n?t:null,r)}function DOe(t,e){let{onlyCounts:r,group:n,maxFiles:i}=t;return r?e?EOe:ROe:n?e?AOe:COe:i?e?TOe:POe:e?OOe:IOe}function MOe(t){return t?jOe:NOe}function UOe(t,e){return new Promise((r,n)=>{m8(t,e,(i,o)=>{if(i)return n(i);r(o)})})}function m8(t,e,r){new p8(t,e,r).start()}function qOe(t,e){return new p8(t,e).start()}var s8,YAe,XAe,sOe,aOe,cOe,uOe,dOe,fOe,pOe,mOe,gOe,yOe,bOe,vOe,wOe,xOe,EOe,AOe,OOe,TOe,ROe,IOe,POe,COe,f8,NOe,jOe,FOe,LOe,zOe,p8,a8,h8,g8,y8=y(()=>{s8=BAe(import.meta.url);YAe=/[\\/]/g;XAe=/^[a-z]:[\\/]$/i;sOe=(t,e)=>{e.push(t||".")},aOe=(t,e,r)=>{let n=t||".";r.every(i=>i(n,!0))&&e.push(n)},cOe=()=>{};uOe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&r.files++},dOe=(t,e,r,n)=>{n.every(i=>i(t,!1))&&e.push(t)},fOe=(t,e,r,n)=>{r.files++},pOe=(t,e)=>{e.push(t)},mOe=()=>{};gOe=t=>t,yOe=()=>[""].slice(0,0);bOe=(t,e,r)=>{t.push({directory:e,files:r,dir:e})},vOe=()=>{};wOe=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()&&d8(t,a,e))return n.dequeue(null,e);r(l,a),n.dequeue(null,e)})})},xOe=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()&&d8(t,s,e))return;r(a,s)}catch(s){if(!o)throw s}};EOe=t=>t.counts,AOe=t=>t.groups,OOe=t=>t.paths,TOe=t=>t.paths.slice(0,t.options.maxFiles),ROe=(t,e,r)=>(Zv(e,r,t.counts,t.options.suppressErrors),null),IOe=(t,e,r)=>(Zv(e,r,t.paths,t.options.suppressErrors),null),POe=(t,e,r)=>(Zv(e,r,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),COe=(t,e,r)=>(Zv(e,r,t.groups,t.options.suppressErrors),null);f8={withFileTypes:!0},NOe=(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||".",f8,(s,a=[])=>{i(a,r,n),t.queue.dequeue(t.options.suppressErrors?null:s,t)})},jOe=(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||".",f8)}catch(a){if(!t.options.suppressErrors)throw a}i(s,r,n)};FOe=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))}},LOe=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}},zOe=class{aborted=!1;abort(){this.aborted=!0}},p8=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(t,e,r){this.isSynchronous=!r,this.callbackInvoker=DOe(e,this.isSynchronous),this.root=GP(t,e),this.state={root:QAe(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new LOe,options:e,queue:new FOe((n,i)=>this.callbackInvoker(i,n,r)),symlinks:new Map,visited:[""].slice(0,0),controller:new zOe,fs:e.fs||KAe},this.joinPath=nOe(this.root,e),this.pushDirectory=lOe(this.root,e),this.pushFile=hOe(e),this.getArray=_Oe(e),this.groupFiles=SOe(e),this.resolveSymlink=$Oe(e,this.isSynchronous),this.walkDirectory=MOe(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(_=GP(_,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=GAe(_),x=GP(ZP(_),this.state.options);_=this.joinPath(S,x),this.pushFile(_,p,this.state.counts,i)}})}}this.groupFiles(this.state.groups,e,p)}};a8=class{constructor(t,e){this.root=t,this.options=e}withPromise(){return UOe(this.root,this.options)}withCallback(t){m8(this.root,this.options,t)}sync(){return qOe(this.root,this.options)}},h8=null;try{s8.resolve("picomatch"),h8=s8("picomatch")}catch{}g8=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:c8,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 a8(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new a8(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){let r=this.globFunction||h8;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 kp=v((mpt,w8)=>{"use strict";var _8="[^\\\\/]",HOe="(?=.)",b8="[^/]",VP="(?:\\/|$)",v8="(?:^|\\/)",WP=`\\.{1,2}${VP}`,BOe="(?!\\.)",GOe=`(?!${v8}${WP})`,ZOe=`(?!\\.{0,1}${VP})`,VOe=`(?!${WP})`,WOe="[^.\\/]",KOe=`${b8}*?`,JOe="/",S8={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:HOe,QMARK:b8,END_ANCHOR:VP,DOTS_SLASH:WP,NO_DOT:BOe,NO_DOTS:GOe,NO_DOT_SLASH:ZOe,NO_DOTS_SLASH:VOe,QMARK_NO_DOT:WOe,STAR:KOe,START_ANCHOR:v8,SEP:JOe},YOe={...S8,SLASH_LITERAL:"[\\\\/]",QMARK:_8,STAR:`${_8}*?`,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:"\\"},XOe={__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"};w8.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:XOe,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?YOe:S8}}});var Ep=v(Ur=>{"use strict";var{REGEX_BACKSLASH:QOe,REGEX_REMOVE_BACKSLASH:eTe,REGEX_SPECIAL_CHARS:tTe,REGEX_SPECIAL_CHARS_GLOBAL:rTe}=kp();Ur.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ur.hasRegexChars=t=>tTe.test(t);Ur.isRegexChar=t=>t.length===1&&Ur.hasRegexChars(t);Ur.escapeRegex=t=>t.replace(rTe,"\\$1");Ur.toPosixSlashes=t=>t.replace(QOe,"/");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(eTe,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 R8=v((gpt,T8)=>{"use strict";var x8=Ep(),{CHAR_ASTERISK:KP,CHAR_AT:nTe,CHAR_BACKWARD_SLASH:Ap,CHAR_COMMA:iTe,CHAR_DOT:JP,CHAR_EXCLAMATION_MARK:YP,CHAR_FORWARD_SLASH:O8,CHAR_LEFT_CURLY_BRACE:XP,CHAR_LEFT_PARENTHESES:QP,CHAR_LEFT_SQUARE_BRACKET:oTe,CHAR_PLUS:sTe,CHAR_QUESTION_MARK:$8,CHAR_RIGHT_CURLY_BRACE:aTe,CHAR_RIGHT_PARENTHESES:k8,CHAR_RIGHT_SQUARE_BRACKET:cTe}=kp(),E8=t=>t===O8||t===Ap,A8=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},lTe=(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,O,D={value:"",depth:0,isGlob:!1},E=()=>l>=n,ae=()=>c.charCodeAt(l+1),X=()=>(A=O,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&&E8(J.charCodeAt(J.length-1))&&(J=J.slice(0,-1)),r.unescape===!0&&(C&&(C=x8.removeBackslashes(C)),J&&_===!0&&(J=x8.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,E8(O)||s.push(D),dr.tokens=s),r.parts===!0||r.tokens===!0){let se;for(let Ce=0;Ce{"use strict";var Op=kp(),ln=Ep(),{MAX_LENGTH:Vv,POSIX_REGEX_SOURCE:uTe,REGEX_NON_SPECIAL_CHARS:dTe,REGEX_SPECIAL_CHARS_BACKREF:fTe,REPLACEMENTS:I8}=Op,pTe=(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=>ln.escapeRegex(i)).join("..")}return r},Yl=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,P8=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},mTe=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},tC=t=>{let e=t.trim(),r=!0;for(;r===!0;)r=!1,/^@\([^\\()[\]{}|]+\)$/.test(e)&&(e=e.slice(2,-1),r=!0);if(mTe(e))return e.replace(/\\(.)/g,"$1")},hTe=t=>{let e=t.map(tC).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}}}}},gTe=t=>`${t.length===1?ln.escapeRegex(t[0]):`[${t.map(r=>ln.escapeRegex(r)).join("")}]`}*`,yTe=t=>{let e=0,r=[];for(;es.trim());if(i.length!==1)return;let o=tC(i[0]);if(!o||o.length!==1)return;r.push(o),e+=n.end+1}if(!(r.length<1))return r},_Te=t=>{let e=0,r=t.trim(),n=eC(r);for(;n;)e++,r=n.body.trim(),n=eC(r);return e},bTe=(t,e)=>{if(e.maxExtglobRecursion===!1)return{risky:!1};let r=typeof e.maxExtglobRecursion=="number"?e.maxExtglobRecursion:Op.DEFAULT_MAX_EXTGLOB_RECURSION,n=P8(t).map(a=>a.trim());if(n.length>1&&(n.some(a=>a==="")||n.some(a=>/^[*?]+$/.test(a))||hTe(n)))return{risky:!0};let i=[],o=!1,s=!0;for(let a of n){let c=yTe(a);if(c){o=!0,i.push(...c);continue}let l=tC(a);if(l&&l.length===1){i.push(l);continue}if(s=!1,_Te(a)>r)return{risky:!0}}return o?s?{risky:!0,safeOutput:gTe([...new Set(i)])}:{risky:!0}:{risky:!1}},rC=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=I8[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=Op.globChars(r.windows),l=Op.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,O=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=ln.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="",ht=0)=>{E.consumed+=G,E.index+=ht},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 ht=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"&&!ht&&!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,ht)=>{let B={...l[ht],conditions:1,inner:""};B.prev=P,B.parens=E.parens,B.output=E.output,B.startIndex=E.index,B.tokensIndex=s.length;let Te=(r.capture?"(":"")+B.open;ki("parens"),fe({type:G,value:ht,output:E.output?"":p}),fe({type:"paren",extglob:!0,value:Ce(),output:Te}),ae.push(B)},Nfe=G=>{let ht=t.slice(G.startIndex,E.index+1),B=t.slice(G.startIndex+2,E.index),Te=bTe(B,r);if((G.type==="plus"||G.type==="star")&&Te.risky){let ut=Te.safeOutput?(G.output?"":p)+(r.capture?`(${Te.safeOutput})`:Te.safeOutput):void 0,Ei=s[G.tokensIndex];Ei.type="text",Ei.value=ht,Ei.output=ut||ln.escapeRegex(ht);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=rC(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,ht=t.replace(fTe,(B,Te,dt,zt,ut,Ei)=>zt==="\\"?(G=!0,B):zt==="?"?Te?Te+zt+(ut?_.repeat(ut.length):""):Ei===0?O+(ut?_.repeat(ut.length):""):_.repeat(dt.length):zt==="."?u.repeat(dt.length):zt==="*"?Te?Te+zt+(ut?D:""):D:Te?B:`\\${B}`);return G===!0&&(r.unescape===!0?ht=ht.replace(/\\/g,""):ht=ht.replace(/\\+/g,B=>B.length%2===0?"\\\\":B?"\\":"")),ht===t&&r.contains===!0?(E.output=t,E):(E.output=ln.wrapOutput(ht,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 Te=/^\\+/.exec(Kt()),dt=0;if(Te&&Te[0].length>2&&(dt=Te[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 Te=P.value.lastIndexOf("["),dt=P.value.slice(0,Te),zt=P.value.slice(Te+2),ut=uTe[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=ln.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(Yl("opening","("));let B=ae[ae.length-1];if(B&&E.parens===B.parens+1){Nfe(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(Yl("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(Yl("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||ln.hasRegexChars(B))continue;let Te=ln.escapeRegex(P.value);if(E.output=E.output.slice(0,-P.value.length),r.literalBrackets===!0){E.output+=Te,P.value=Te;continue}P.value=`(${a}${Te}|${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 Te=")";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);Te=pTe(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=Te="\\}",E.output=dt;for(let ut of zt)E.output+=ut.output||ut.value}fe({type:"brace",value:C,output:Te}),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,Te=X[X.length-1];Te&&J[J.length-1]==="braces"&&(Te.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 Te=se(),dt=C;(P.value==="("&&!/[!=<:]/.test(Te)||Te==="<"&&!/<([!=]|\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=dTe.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,Te=B.prev,dt=B.type==="slash"||B.type==="bos",zt=Te&&(Te.type==="star"||Te.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 ht={type:"star",value:C,output:D};if(r.bash===!0){ht.output=".*?",(P.type==="bos"||P.type==="slash")&&(ht.output=A+ht.output),fe(ht);continue}if(P&&(P.type==="bracket"||P.type==="paren")&&r.regex===!0){ht.output=C,fe(ht);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(ht)}for(;E.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","]"));E.output=ln.escapeLast(E.output,"["),tn("brackets")}for(;E.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing",")"));E.output=ln.escapeLast(E.output,"("),tn("parens")}for(;E.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(Yl("closing","}"));E.output=ln.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};rC.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=I8[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}=Op.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 O=/^(.*?)\.(\w+)$/.exec(A);if(!O)return;let D=x(O[1]);return D?D+o+O[2]:void 0}}},w=ln.removePrefix(t,b),R=x(w);return R&&r.strictSlashes!==!0&&(R+=`${s}?`),R};C8.exports=rC});var M8=v((_pt,j8)=>{"use strict";var vTe=R8(),nC=D8(),N8=Ep(),STe=kp(),wTe=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=wTe(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?N8.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(N8.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)):nC(t,{...e,fastpaths:!1});Rt.scan=(t,e)=>vTe(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=nC.fastpaths(t,e)),i.output||(i=nC(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=STe;j8.exports=Rt});var U8=v((bpt,z8)=>{"use strict";var F8=M8(),xTe=Ep();function L8(t,e,r=!1){return e&&(e.windows===null||e.windows===void 0)&&(e={...e,windows:xTe.isWindows()}),F8(t,e,r)}Object.assign(L8,F8);z8.exports=L8});import{readdir as $Te,readdirSync as kTe,realpath as ETe,realpathSync as ATe,stat as OTe,statSync as TTe}from"fs";import{isAbsolute as RTe,posix as Wa,resolve as ITe}from"path";import{fileURLToPath as PTe}from"url";function jTe(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]===".."&&NTe.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 LTe(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 H8(t){return t.replace(DTe,e=>`${e}/`)}function V8(t){var e;let r=Xl.default.scan(t,zTe);return!((e=r.parts)===null||e===void 0)&&e.length?r.parts:[t]}function ZTe(t,e){if(e?.caseSensitiveMatch===!1)return!0;let r=Xl.default.scan(t);return r.isGlob||r.negated}function Tp(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function W8(t){return typeof t=="string"?[t]:t??[]}function iC(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=GTe(o);s=RTe(s.replace(WTe,""))?Wa.relative(a,s):Wa.normalize(s);let c=(i=VTe.exec(s))===null||i===void 0?void 0:i[0],l=V8(s);if(c){let d=(c.length+1)/3,f=0,p=a.split("/");for(;fm.length&&(r.root=H8(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 KTe(t,e,r){let n=[],i=[];for(let o of t.ignore)o&&(o[0]!=="!"||o[1]==="(")&&i.push(iC(o,t,r,!0));for(let o of e)o&&(o[0]!=="!"||o[1]==="("?n.push(iC(o,t,r,!1)):(o[1]!=="!"||o[2]==="(")&&i.push(iC(o.slice(1),t,r,!0)));return{match:n,ignore:i}}function JTe(t,e){let r=t.cwd,n={root:r,depthOffset:0},i=KTe(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(G8,""),f={dot:c,nobrace:t.braceExpansion===!1,nocase:!s,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},p=(0,Xl.default)(i.match,f),m=(0,Xl.default)(i.ignore,f),h=jTe(i.match,f),g=q8(r,d,o),b=o?g:q8(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 g8({filters:[a?(w,R)=>{let A=g(w,R),O=p(A)&&!m(A);return O&&Tp(`matched ${A}`),O}:(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&<e(r,d)]}function YTe(t,e){if(e)for(let r=t.length-1;r>=0;r--)t[r]=e(t[r]);return t}function XTe(t){let e=Object.assign({},t);for(let r in B8)e[r]===void 0&&Object.assign(e,{[r]:B8[r]});return e.cwd=(e.cwd instanceof URL?PTe(e.cwd):ITe(e.cwd||process.cwd())).replace(G8,"/"),e.ignore=W8(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||$Te,readdirSync:e.fs.readdirSync||kTe,realpath:e.fs.realpath||ETe,realpathSync:e.fs.realpathSync||ATe,stat:e.fs.stat||OTe,statSync:e.fs.statSync||TTe}),e.debug&&Tp("globbing with options:",e),e}function QTe(t,e={}){var r;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");let n=CTe(t)||typeof t=="string",i=W8((r=n?t:t.patterns)!==null&&r!==void 0?r:"**/*"),o=XTe(n?e:t);return i.length>0?JTe(o,i):[]}function vs(t,e){let[r,n]=QTe(t,e);return r?YTe(r.sync(),n):[]}var Xl,CTe,G8,DTe,Z8,NTe,MTe,FTe,zTe,UTe,qTe,HTe,BTe,GTe,VTe,WTe,B8,Rp=y(()=>{y8();Xl=wt(U8(),1),CTe=Array.isArray,G8=/\\/g,DTe=/^[A-Za-z]:$/,Z8=process.platform==="win32",NTe=/^(\/?\.\.)+$/;MTe=/^[A-Z]:\/$/i,FTe=Z8?t=>MTe.test(t):t=>t==="/";zTe={parts:!0};UTe=/(?t.replace(UTe,"\\$&"),BTe=t=>t.replace(qTe,"\\$&"),GTe=Z8?BTe:HTe;VTe=/^(\/?\.\.)+/,WTe=/\\(?=[()[\]{}!*+?@|])/g;B8={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0}});import{existsSync as Ip,readFileSync as eRe,readdirSync as tRe,statSync as K8}from"node:fs";import{join as Ka}from"node:path";function rRe(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}=oC(r);return(s.size>0||a.length>0)&&!Ip(Ka(e,i.mainRoot))?[{detector:Pp,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&&(nRe(e,i,s,o),iRe(e,i,s,o)),a.length>0&&oRe(e,i,a,o),o)}function oC(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 nRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of tRe(o)){let a=Ka(o,s);K8(a).isDirectory()&&(r.has(s)||n.push({detector:Pp,severity:"warn",path:`${i}/${s}/`,message:`${i}/${s}/ is not declared in spec/architecture.yaml layers \u2014 add it or remove the directory`}))}}function iRe(t,e,r,n){let i=e.mainRoot,o=Ka(t,i);if(Ip(o))for(let s of r){let a=Ka(o,s);Ip(a)&&K8(a).isDirectory()||n.push({detector:Pp,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 oRe(t,e,r,n){let i=e.mainRoot,o=e.importMatcher;for(let s of r){let a=Ka(t,i,s.from);if(!Ip(a))continue;let c=vs([`**/*.${e.ext}`],{cwd:a,dot:!1});for(let l of c){let u=Ka(a,l),d;try{d=eRe(u,"utf8")}catch{continue}let f;for(o.lastIndex=0;(f=o.exec(d))!==null;){let p=f[1];sRe(p,s.to,e.importStyle)&&n.push({detector:Pp,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 sRe(t,e,r){return r==="dotted"?t.split(".").includes(e):t.startsWith(".")?t.split("/").includes(e):!1}var Pp,J8,sC=y(()=>{"use strict";Rp();Ue();Va();Pp="ARCHITECTURE_FROM_SPEC";J8={name:Pp,run:rRe}});import{existsSync as aRe,readFileSync as cRe}from"node:fs";import{join as lRe}from"node:path";function dRe(t){let{cwd:e="."}=t,r=lRe(e,"spec/capabilities.yaml");if(!aRe(r))return[];let n;try{let u=cRe(r,"utf8"),d=Y8.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";Y8=wt(tr(),1);Ue();Wv="CAPABILITIES_FEATURE_MAPPING",uRe=8;X8={name:Wv,run:dRe}});import{existsSync as fRe,readFileSync as pRe}from"node:fs";import{join as mRe}from"node:path";function hRe(t){let e=t.trimStart();return e.startsWith("//")||e.startsWith("/*")||e.startsWith("#")||e.startsWith('"""')||e.startsWith("'''")}function gRe(t){let{cwd:e="."}=t;return ye(e,aC,r=>yRe(r,e))}function yRe(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=mRe(e,o);if(!fRe(s))continue;let a=pRe(s,"utf8");hRe(a)||n.push({detector:aC,severity:"warn",path:o,message:`${o} has no file-header comment \u2014 Why>What guardrail recommends a one-line intent`})}return n}var aC,e5,t5=y(()=>{"use strict";Va();xt();aC="CONVENTION_DRIFT";e5={name:aC,run:gRe}});import{existsSync as cC,readFileSync as r5}from"node:fs";import{join as Kv}from"node:path";function _Re(t){return JSON.parse(t).total?.lines?.pct??0}function n5(t){let e=/]*\bline-rate="([0-9]*\.?[0-9]+)"/.exec(t);return e?Number(e[1])*100:null}function SRe(t,e){if(!Cv(_t(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=MP.find(d=>cC(Kv(c.dir,d)));if(!l){s.push(c.path);continue}let u=n5(r5(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=i5(n,i);return a0?[{detector:Eo,severity:"info",message:`module coverage ${a.toFixed(1)}% OK; no report yet for ${s.join(", ")}`}]:[]}function wRe(t){let{cwd:e="."}=t;if(t.focusModules&&t.focusModules.length>0){let a=SRe(e,t.focusModules);if(a)return a}let r;try{r=q(e).project?.language}catch{}let n=Li(e,r),i=_t(e).language==="kotlin"?MP.find(a=>cC(Kv(e,a)))??FJ(e):n.coverageSummary,o=Kv(e,i);if(!cC(o))return[{detector:Eo,severity:"info",message:`${i} not present \u2014 run stage_2.2 first`}];let s;try{let a=r5(o,"utf8");s=n.coverageFormat==="jacoco-xml"?bRe(a):n.coverageFormat==="cobertura-xml"?vRe(a):_Re(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,o5,s5=y(()=>{"use strict";Ue();Mv();Va();Nv();Dn();Eo="COVERAGE_DROP",Jv=70;o5={name:Eo,run:wRe}});import{existsSync as xRe}from"node:fs";import{join as $Re}from"node:path";function ERe(t){let{cwd:e="."}=t;return ye(e,Yv,r=>ARe(r,e))}function ARe(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",kRe=8;a5={name:Yv,run:ERe}});function ORe(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 TRe(t){let e=ORe(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 RRe(t){let{cwd:e="."}=t;return ye(e,Xv,r=>TRe(r))}var Xv,l5,u5=y(()=>{"use strict";xt();Xv="SMOKE_PROBE_DEMAND";l5={name:Xv,run:RRe}});function IRe(t){let{cwd:e="."}=t;return ye(e,Qv,r=>PRe(r,e))}function PRe(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,lC=y(()=>{"use strict";El();xt();Qv="STALE_ATTESTATION";eS={name:Qv,run:IRe}});function CRe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}return DRe(r)}function DRe(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:d5,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 d5,tS,uC=y(()=>{"use strict";Ue();d5="DEPENDENCY_CYCLE";tS={name:d5,run:CRe}});import{appendFileSync as NRe,existsSync as f5,mkdirSync as jRe,readFileSync as MRe}from"node:fs";import{dirname as FRe,join as LRe}from"node:path";function p5(t){return LRe(t,zRe,URe)}function m5(t){return dC.add(t),()=>dC.delete(t)}function Ja(t,e){let r=p5(t),n=FRe(r);f5(n)||jRe(n,{recursive:!0}),NRe(r,`${JSON.stringify(e)} +`,"utf8");for(let i of dC)try{i(t,e)}catch{}}function pr(t){let e=p5(t);if(!f5(e))return[];let r=MRe(e,"utf8").trim();return r.length===0?[]:r.split(` +`).filter(n=>n.length>0).map(n=>JSON.parse(n))}var zRe,URe,dC,un=y(()=>{"use strict";zRe=".cladding",URe="audit.log.jsonl";dC=new Set});import{existsSync as qRe}from"node:fs";import{join as HRe}from"node:path";function BRe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:fC,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&&(qRe(HRe(e,i.artifact))||n.push({detector:fC,severity:"error",path:i.artifact,message:`evidence ${i.id} references missing artifact '${i.artifact}'`}));return n}var fC,h5,g5=y(()=>{"use strict";un();fC="EVIDENCE_MISMATCH";h5={name:fC,run:BRe}});import{existsSync as GRe,readFileSync as ZRe}from"node:fs";import{join as VRe}from"node:path";function WRe(t){let e=VRe(t,v5);if(!GRe(e))return null;try{let n=((0,b5.parse)(ZRe(e,"utf8"))?.fixtures??[]).map(i=>i.name).filter(Boolean);return new Set(n)}catch{return null}}function*_5(t,e){for(let r of t??[])r.startsWith(y5)&&(yield{ref:r,name:r.slice(y5.length),field:e})}function KRe(t){let{cwd:e="."}=t,r=WRe(e);if(r===null)return[];let n;try{n=q(e)}catch(o){return[{detector:pC,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=[..._5(s.evidence_refs,"evidence_refs"),..._5(s.test_refs,"test_refs")];for(let{ref:c,name:l,field:u}of a)r.has(l)||i.push({detector:pC,severity:"warn",path:v5,message:`${o.id}.${s.id} cites '${c}' in ${u} but no fixture named '${l}' is registered in conformance/fixtures.yaml`})}return i}var b5,pC,y5,v5,S5,w5=y(()=>{"use strict";b5=wt(tr(),1);Ue();pC="FIXTURE_REFERENCE_INVALID",y5="fixture:",v5="conformance/fixtures.yaml";S5={name:pC,run:KRe}});import{existsSync as Ql,readFileSync as mC}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 Cp(t){if(!Ql(t))return null;try{return JSON.parse(mC(t,"utf8"))}catch{return null}}function YRe(t,e){let r=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json"),n;try{n=JSON.parse(mC(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 XRe(t,e){for(let r of x5){let n=Ya(t,r.path);if(!Ql(n))continue;let i=Cp(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 QRe(t,e){let r=Cp(Ya(t,"package.json"));if(!r?.version)return;let n=r.version;for(let o of x5){let s=Ya(t,o.path);if(!Ql(s))continue;let a=Cp(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(Ql(i)){let o=Cp(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 eIe(t){let e=t.match(/TIER_STAGES[\s\S]*?\ball:\s*\[([^\]]*)\]/);return e?[...e[1].matchAll(/['"]([^'"]+)['"]/g)].map(r=>r[1]):[]}function tIe(t,e){let r=Ya(t,"src","cli","clad.ts"),n=Ya(t,"plugins","claude-code",".claude-plugin","plugin.json");if(!Ql(r)||!Ql(n))return;let i=eIe(mC(r,"utf8"));if(i.length===0)return;let s=Cp(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 rIe(t){let{cwd:e="."}=t,r=[];return YRe(e,r),tIe(e,r),XRe(e,r),QRe(e,r),r}var Ao,x5,$5,k5=y(()=>{"use strict";Rp();Ao="HARNESS_INTEGRITY",x5=[{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"]}];$5={name:Ao,run:rIe}});import{existsSync as nIe,readFileSync as iIe}from"node:fs";import{join as oIe}from"node:path";function aIe(t){let{cwd:e="."}=t;return ye(e,rS,r=>lIe(r,e))}function cIe(t){let e=oIe(t,"spec/capabilities.yaml");if(!nIe(e))return!1;try{let r=E5.default.parse(iIe(e,"utf8"));if(!r||typeof r!="object")return!1;let n=r.capabilities;return!Array.isArray(n)||n.length===0}catch{return!1}}function lIe(t,e){let r=t.features.length;if(r{"use strict";E5=wt(tr(),1);xt();rS="HOLLOW_GOVERNANCE",sIe=8;A5={name:rS,run:aIe}});function uIe(t,e){let r=t.slice(0,e).split(/\r\n|\n|\r/g);return[r.length,r.pop().length+1]}function dIe(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]=uIe(r.toml,r.ptr),o=dIe(r.toml,n,i);super(`Invalid TOML document: ${e} @@ -276,30 +276,30 @@ ${o}`,r),this.line=n,this.column=i,this.codeblock=o}}});function fIe(t,e){let r= `)return r;if(n==="\r"&&t[r+1]===` `)return r+1;if(n<" "&&n!==" "||n==="\x7F")throw new ge("control characters are not allowed in comments",{toml:t,ptr:e})}return t.length}function dn(t,e,r,n){let i;for(;;){for(;(i=t[e])===" "||i===" "||!r&&(i===` `||i==="\r"&&t[e+1]===` -`);)e++;if(n||i!=="#")break;e=eu(t,e)}return e}function O5(t,e,r,n,i=!1){if(!n)return e=nS(t,e),e<0?t.length:e;for(let o=e;o-1&&r!=="'"&&fIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Dp=y(()=>{Xa();});var pIe,Qa,mC=y(()=>{pIe=/^(\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(pIe);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]===` +`))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!=="'"&&fIe(t,e));return e>-1&&(e+=n.length,n.length>1&&(t[e]===r&&e++,t[e]===r&&e++)),e}var Dp=y(()=>{Xa();});var pIe,Qa,hC=y(()=>{pIe=/^(\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(pIe);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{Dp();mC();Xa();mIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,hIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,gIe=/^[+-]?0[0-9_]/,yIe=/^[0-9a-f]{2,8}$/i,R5={b:"\b",t:" ",n:` +`&&t[e]!=="\r")throw new ge("invalid escape: only line-ending whitespace may be escaped",{toml:t,ptr:o});e=dn(t,e)}else if(l in R5)a+=R5[l];else throw new ge("unrecognized escape sequence",{toml:t,ptr:o});c=e}else!n&&l==="\\"&&(o=e-1,s=!0,a+=t.slice(c,o))}return a+t.slice(c,r-1)}function I5(t,e,r,n){if(t==="true")return!0;if(t==="false")return!1;if(t==="-inf")return-1/0;if(t==="inf"||t==="+inf")return 1/0;if(t==="nan"||t==="+nan"||t==="-nan")return NaN;if(t==="-0")return n?0n:0;let i=mIe.test(t);if(i||hIe.test(t)){if(gIe.test(t))throw new ge("leading zeroes are not allowed",{toml:e,ptr:r});t=t.replace(/_/g,"");let s=+t;if(isNaN(s))throw new ge("invalid number",{toml:e,ptr:r});if(i){if((i=!Number.isSafeInteger(s))&&!n)throw new ge("integer value cannot be represented losslessly",{toml:e,ptr:r});(i||n===!0)&&(s=BigInt(t))}return s}let o=new Qa(t);if(!o.isValid())throw new ge("invalid value",{toml:e,ptr:r});return o}var mIe,hIe,gIe,yIe,R5,gC=y(()=>{Dp();hC();Xa();mIe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,hIe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,gIe=/^[+-]?0[0-9_]/,yIe=/^[0-9a-f]{2,8}$/i,R5={b:"\b",t:" ",n:` `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"}});function _Ie(t,e,r){let n=t.slice(e,r),i=n.indexOf("#");return i>-1&&(eu(t,i),n=n.slice(0,i)),[n.trimEnd(),i]}function Np(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==="["?C5(t,e,n,i):P5(t,e,n,i);if(r){if(l=dn(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=dn(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=O5(t,e,",",r);let a=_Ie(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=dn(t,e+a[1]),s+=+(t[s]===",")),[I5(a[0],t,e,i),s]}var gC=y(()=>{hC();yC();Dp();Xa();});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(!bIe.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-1&&(s=dn(t,e+a[1]),s+=+(t[s]===",")),[I5(a[0],t,e,i),s]}var yC=y(()=>{gC();_C();Dp();Xa();});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(!bIe.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{hC();gC();Dp();Xa();bIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function D5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{yC();gC();Dp();Xa();});function jp(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function vIe(t){for(let e=0;e{gC();yC();Dp();Xa();bIe=/^[a-zA-Z0-9-_]+[ \t]*$/});function D5(t,e,r,n){let i=e,o=r,s,a=!1,c;for(let l=0;l{_C();yC();Dp();Xa();});function jp(t){let e=typeof t;if(e==="object"){if(Array.isArray(t))return"array";if(t instanceof Date)return"date"}return e}function vIe(t){for(let e=0;e{j5=/^[a-z0-9-_]+$/i});var xC={};Nr(xC,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>$Ie,parse:()=>_C,stringify:()=>wC});var $Ie,$C=y(()=>{N5();M5();mC();Xa();$Ie={parse:_C,stringify:wC,TomlDate:Qa,TomlError:ge}});import{cpSync as kIe,existsSync as jn,lstatSync as EIe,mkdirSync as AIe,readFileSync as uS,readlinkSync as TIe,readdirSync as OIe,rmSync as L5,writeFileSync as ec}from"node:fs";import{homedir as z5,platform as U5}from"node:os";import{basename as RIe,dirname as Ss,isAbsolute as IIe,join as he,relative as PIe,resolve as ws}from"node:path";import{fileURLToPath as CIe}from"node:url";import{spawnSync as q5}from"node:child_process";function aS(t){AIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return EIe(t).isSymbolicLink()}catch{return!1}}function jIe(t){try{return ws(Ss(t),TIe(t))}catch{return null}}function H5(t,e){let r=PIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!IIe(r)}function MIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",EC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=jIe(t);if(!r||!e.some(n=>H5(r,n)))return"skipped-different";try{return L5(t,{force:!0}),"removed"}catch{return"failed"}}function FIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of OIe(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 Lp(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]===AC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>H5(n[0],i))}function LIe(t,e){let r=t.split(` +`:n}var j5,M5=y(()=>{j5=/^[a-z0-9-_]+$/i});var $C={};Nr($C,{TomlDate:()=>Qa,TomlError:()=>ge,default:()=>$Ie,parse:()=>bC,stringify:()=>xC});var $Ie,kC=y(()=>{N5();M5();hC();Xa();$Ie={parse:bC,stringify:xC,TomlDate:Qa,TomlError:ge}});import{cpSync as kIe,existsSync as jn,lstatSync as EIe,mkdirSync as AIe,readFileSync as uS,readlinkSync as OIe,readdirSync as TIe,rmSync as L5,writeFileSync as ec}from"node:fs";import{homedir as z5,platform as U5}from"node:os";import{basename as RIe,dirname as Ss,isAbsolute as IIe,join as he,relative as PIe,resolve as ws}from"node:path";import{fileURLToPath as CIe}from"node:url";import{spawnSync as q5}from"node:child_process";function aS(t){AIe(t,{recursive:!0})}function si(t){try{return uS(t,"utf8")}catch{return null}}function tc(t,e){let r=si(t);return r===e?"unchanged":(aS(Ss(t)),ec(t,e,"utf8"),r==null?"created":"rewired")}function cS(t){try{return EIe(t).isSymbolicLink()}catch{return!1}}function jIe(t){try{return ws(Ss(t),OIe(t))}catch{return null}}function H5(t,e){let r=PIe(ws(e),ws(t));return r===""||!r.startsWith("..")&&!IIe(r)}function MIe(t,e){let r=[ws(e)],n=si(he(t,".cladding",AC));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 lS(t,e){if(!jn(t)&&!cS(t))return"unchanged";if(!cS(t))return"skipped-different";let r=jIe(t);if(!r||!e.some(n=>H5(r,n)))return"skipped-different";try{return L5(t,{force:!0}),"removed"}catch{return"failed"}}function FIe(t,e){let r=he(t,".agents","skills");if(!jn(r))return"unchanged";let n=0,i=0;for(let o of TIe(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 Lp(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]===OC?!0:r.command==="node"&&typeof n[0]=="string"&&e.some(i=>H5(n[0],i))}function LIe(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 zIe(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(()=>($C(),xC)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Lp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=LIe(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 UIe(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?Lp(o.cladding,e)?(delete o.cladding,Object.keys(o).length===0&&delete i.mcpServers,ec(r,`${JSON.stringify(i,null,2)} +`)}async function zIe(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(()=>(kC(),$C)),s=i(n),a=s.mcp_servers;if(!a?.cladding)return"unchanged";if(!Lp(a.cladding,e))return"skipped-different";delete a.cladding,Object.keys(a).length===0&&delete s.mcp_servers;let c=LIe(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 UIe(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?Lp(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 qIe(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=Fp(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 tu([o,tc(he(n,"plugin.json"),s)])}function HIe(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&&!Lp(i.cladding,e)?"skipped-different":"unchanged"}catch{return"skipped-different"}}function BIe(t){let e=U5()==="win32"?"where":"which";return q5(e,[t],{stdio:"ignore"}).status===0}function GIe(t){if(!t||!BIe("claude"))return"manual-required";let e=q5("claude",["plugin","uninstall","claude-code@cladding","--scope","user","--keep-data"],{encoding:"utf8",timeout:3e4,shell:U5()==="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 ZIe(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(` @@ -308,16 +308,16 @@ ${e.stderr??""}`;return/not installed|not found/i.test(r)?"unchanged":"manual-re `)?` `:"";ec(e,`${n}${s}${o.join(` `)} -`,"utf8")}function KIe(){return{command:"node",args:[AC]}}function kC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- +`,"utf8")}function KIe(){return{command:"node",args:[OC]}}function EC(t,e,r){if(!jn(t))return"failed";let n=si(he(t,"SKILL.md"));if(n==null||!n.startsWith(`--- `))return"failed";let i=RIe(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";L5(e,{recursive:!0,force:!0})}return aS(Ss(e)),kIe(t,e,{recursive:!0,dereference:!0}),ec(he(e,"SKILL.md"),o,"utf8"),"created"}function Fp(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&&!Lp(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 NIe)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 YIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>($C(),xC)),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&&!Lp(c,[])?"skipped-different":(a.cladding=l,tc(t,i(s)))}catch{return"failed"}}function XIe(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 tu(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 B5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function F5(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 OC(t={}){let e=t.home??z5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??G5(),i=t.version??Z5(n),o=ePe(e),s=new Set(t.hosts??DIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",EC),l=B5(c),u=[],d=[];aS(r),WIe(r);let f=[tc(he(r,AC),ZIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),VIe()));let p=tu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?kC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=KIe(),b=MIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?GIe(t.activate??!0):"unchanged",x={claude_plugin:tu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:HIe(e,b),codex_skills:FIe(e,b),codex_mcp:await zIe(e,b),cursor_mcp:UIe(e,b)},w=s.has("codex")?await YIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?Fp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?tu([Fp(he(r,".agents","mcp_config.json"),g,a),qIe(e,n,a)]):"skipped-not-selected",T=s.has("claude")?tu([kC(m,he(r,".claude","skills","cladding-init"),a),Fp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?tu([kC(m,he(r,".cursor","skills","cladding-init"),a),Fp(he(r,".cursor","mcp.json"),g,a),JIe(he(r,".cursor","cli.json")),XIe(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))F5(J,X,u,d);for(let[X,J]of Object.entries(x))F5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(c,`${JSON.stringify({project_root:r,cladding_root:n,cladding_version:i,last_run:new Date().toISOString()},null,2)} +`))}catch{return"failed"}}async function YIe(t,e,r){try{let{parse:n,stringify:i}=await Promise.resolve().then(()=>(kC(),$C)),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&&!Lp(c,[])?"skipped-different":(a.cladding=l,tc(t,i(s)))}catch{return"failed"}}function XIe(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 tu(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 B5(t){try{return JSON.parse(uS(t,"utf8")).cladding_version??null}catch{return null}}function F5(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 RC(t={}){let e=t.home??z5(),r=ws(t.projectRoot??process.cwd()),n=t.pkgRoot??G5(),i=t.version??Z5(n),o=ePe(e),s=new Set(t.hosts??DIe.filter(X=>o[X])),a=t.force??!1,c=he(r,".cladding",AC),l=B5(c),u=[],d=[];aS(r),WIe(r);let f=[tc(he(r,OC),ZIe(n))];s.has("gemini")&&f.push(tc(he(r,TC),VIe()));let p=tu(f),m=he(n,"plugins","codex","skills","init"),h=s.has("codex")||s.has("gemini")||s.has("antigravity")?EC(m,he(r,".agents","skills","cladding-init"),a):"unchanged",g=KIe(),b=MIe(e,n),_=lS(he(e,".claude","plugins","cladding"),b),S=_==="removed"?GIe(t.activate??!0):"unchanged",x={claude_plugin:tu([_,S]),gemini_extension:lS(he(e,".gemini","extensions","cladding"),b),antigravity_plugin:HIe(e,b),codex_skills:FIe(e,b),codex_mcp:await zIe(e,b),cursor_mcp:UIe(e,b)},w=s.has("codex")?await YIe(he(r,".codex","config.toml"),g,a):"skipped-not-selected",R=s.has("gemini")?Fp(he(r,".gemini","settings.json"),g,a):"skipped-not-selected",A=s.has("antigravity")?tu([Fp(he(r,".agents","mcp_config.json"),g,a),qIe(e,n,a)]):"skipped-not-selected",O=s.has("claude")?tu([EC(m,he(r,".claude","skills","cladding-init"),a),Fp(he(r,".mcp.json"),g,a)]):"skipped-not-selected",D=s.has("cursor")?tu([EC(m,he(r,".cursor","skills","cladding-init"),a),Fp(he(r,".cursor","mcp.json"),g,a),JIe(he(r,".cursor","cli.json")),XIe(r)]):"skipped-not-selected",E={runtime:p,shared_init_skill:h,claude:O,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))F5(J,X,u,d);for(let[X,J]of Object.entries(x))F5(J,`legacy:${X}`,u,d);aS(Ss(c)),ec(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(`${QIe(ae)} `),ae}function Mp(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 QIe(t,e){let r=[`cladding setup \u2014 project activation: ${t.projectRoot}`,"",` Claude Code \u2192 ${Mp(t.wiring.claude)}`,` Codex \u2192 ${Mp(t.wiring.codex)}`,` Gemini CLI \u2192 ${Mp(t.wiring.gemini)}`,` Antigravity \u2192 ${Mp(t.wiring.antigravity)}`,` Cursor \u2192 ${Mp(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 G5(){let t=CIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function Z5(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 fn(t=G5()){let e=Z5(t);return e==="unknown"?null:e}function V5(t=process.cwd()){return B5(he(ws(t),".cladding",EC))}function ePe(t=z5()){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 EC,AC,TC,DIe,NIe,ru=y(()=>{"use strict";EC="setup-status.json",AC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",DIe=["claude","codex","gemini","antigravity","cursor"],NIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as W5,readFileSync as K5}from"node:fs";import{join as J5}from"node:path";function Y5(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 sPe(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 X5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function Q5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function aPe(t,e){let r=Q5(t),n=Q5(e);if(!r||!n)return!1;for(let i=0;ioPe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(nPe)?.[1],s=fn();return o!==void 0&&s!==null&&aPe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function lPe(t){let e=J5(t,"README.md"),r=J5(t,"docs","dogfood","matrix.md");if(!W5(e)||!W5(r))return[];let n=K5(e,"utf8"),i=K5(r,"utf8"),o=Y5(n,tPe),s=Y5(i,rPe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=X5(d);if(f===null)continue;let p=s[u]??"not-run",m=sPe(p);m!==null&&f>m&&a.push({detector:RC,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=>X5(u)!==null)?cPe(i,Date.now()):[];return l.length>0&&a.push({detector:RC,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 uPe(t){let{cwd:e="."}=t;return lPe(e)}var RC,tPe,rPe,nPe,iPe,oPe,eY,tY=y(()=>{"use strict";ru();RC="HOST_CLAIM_DRIFT",tPe=//,rPe=//,nPe=/^- Cladding version:\s*`([^`]+)`\s*$/m,iPe=/^- Generated:\s*(\S+)\s*$/m,oPe=720*60*60*1e3;eY={name:RC,run:uPe}});function dPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return rY(r.features.map(i=>i.id),"feature","spec/features/",n),rY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function rY(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:nY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var nY,iY,oY=y(()=>{"use strict";Ue();nY="ID_COLLISION";iY={name:nY,run:dPe}});import{existsSync as zp,readFileSync as IC,readdirSync as PC,statSync as fPe,writeFileSync as aY}from"node:fs";import{join as To}from"node:path";function sY(t){if(!zp(t))return 0;try{return PC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function pPe(t){if(!zp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=PC(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=fPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function mPe(t){let e=To(t,"spec","capabilities.yaml");if(!zp(e))return 0;try{let r=dS.default.parse(IC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=sY(To(t,"spec","features")),r=sY(To(t,"spec","scenarios")),n=mPe(t),i=pPe(To(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function nu(t,e){let r=To(t,"spec.yaml");if(!zp(r))return;let n=IC(r,"utf8"),i=hPe(n,e);i!==n&&aY(r,i)}function hPe(t,e){let r=t.includes(`\r +`)}function G5(){let t=CIe(import.meta.url),e=Ss(t);for(let r=0;r<7;r++){try{if(JSON.parse(uS(he(e,"package.json"),"utf8")).name==="cladding")return e}catch{}e=Ss(e)}return ws(Ss(t),"..")}function Z5(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 fn(t=G5()){let e=Z5(t);return e==="unknown"?null:e}function V5(t=process.cwd()){return B5(he(ws(t),".cladding",AC))}function ePe(t=z5()){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 AC,OC,TC,DIe,NIe,ru=y(()=>{"use strict";AC="setup-status.json",OC=he(".cladding","host","serve.cjs"),TC=".cladding/host/gemini-doctor-policy.toml",DIe=["claude","codex","gemini","antigravity","cursor"],NIe=["Mcp(cladding:clad_list_features)","Mcp(cladding:clad_get_feature)","Mcp(cladding:clad_run_check)"]});import{existsSync as W5,readFileSync as K5}from"node:fs";import{join as J5}from"node:path";function Y5(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 sPe(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 X5(t){switch(t){case"wiring-only":return 1;case"verified":return 2;default:return null}}function Q5(t){let e=t.match(/^(\d+)\.(\d+)\.(\d+)(?:[-+]|$)/);return e?[Number(e[1]),Number(e[2]),Number(e[3])]:null}function aPe(t,e){let r=Q5(t),n=Q5(e);if(!r||!n)return!1;for(let i=0;ioPe&&r.push(`generated ${n}, more than 30 days ago`);let o=t.match(nPe)?.[1],s=fn();return o!==void 0&&s!==null&&aPe(o,s)&&r.push(`generated by cladding v${o}, before the current v${s}`),r}function lPe(t){let e=J5(t,"README.md"),r=J5(t,"docs","dogfood","matrix.md");if(!W5(e)||!W5(r))return[];let n=K5(e,"utf8"),i=K5(r,"utf8"),o=Y5(n,tPe),s=Y5(i,rPe);if(!o||!s)return[];let a=[];for(let[u,d]of Object.entries(o)){let f=X5(d);if(f===null)continue;let p=s[u]??"not-run",m=sPe(p);m!==null&&f>m&&a.push({detector:IC,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=>X5(u)!==null)?cPe(i,Date.now()):[];return l.length>0&&a.push({detector:IC,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 uPe(t){let{cwd:e="."}=t;return lPe(e)}var IC,tPe,rPe,nPe,iPe,oPe,eY,tY=y(()=>{"use strict";ru();IC="HOST_CLAIM_DRIFT",tPe=//,rPe=//,nPe=/^- Cladding version:\s*`([^`]+)`\s*$/m,iPe=/^- Generated:\s*(\S+)\s*$/m,oPe=720*60*60*1e3;eY={name:IC,run:uPe}});function dPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return rY(r.features.map(i=>i.id),"feature","spec/features/",n),rY((r.scenarios??[]).map(i=>i.id),"scenario","spec/scenarios/",n),n}function rY(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:nY,severity:"error",message:`${e} id '${o}' appears ${s} times across ${r} \u2014 every ${e} must have a unique id; resolve the duplicate`})}var nY,iY,oY=y(()=>{"use strict";Ue();nY="ID_COLLISION";iY={name:nY,run:dPe}});import{existsSync as zp,readFileSync as PC,readdirSync as CC,statSync as fPe,writeFileSync as aY}from"node:fs";import{join as Oo}from"node:path";function sY(t){if(!zp(t))return 0;try{return CC(t).filter(e=>e.endsWith(".yaml")||e.endsWith(".yml")).length}catch{return 0}}function pPe(t){if(!zp(t))return 0;let e=0,r=[t];for(;r.length>0;){let n=r.pop(),i;try{i=CC(n)}catch{continue}for(let o of i){if(o==="node_modules"||o===".cladding"||o.startsWith("."))continue;let s=Oo(n,o),a;try{a=fPe(s)}catch{continue}a.isDirectory()?r.push(s):(o.endsWith(".test.ts")||o.endsWith(".test.tsx"))&&e++}}return e}function mPe(t){let e=Oo(t,"spec","capabilities.yaml");if(!zp(e))return 0;try{let r=dS.default.parse(PC(e,"utf8"));return Array.isArray(r?.capabilities)?r.capabilities.length:0}catch{return 0}}function xs(t="."){let e=sY(Oo(t,"spec","features")),r=sY(Oo(t,"spec","scenarios")),n=mPe(t),i=pPe(Oo(t,"tests"));return{features:e,scenarios:r,capabilities:n,test_files:i}}function nu(t,e){let r=Oo(t,"spec.yaml");if(!zp(r))return;let n=PC(r,"utf8"),i=hPe(n,e);i!==n&&aY(r,i)}function hPe(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(!zp(e))return!1;let r=[];for(let i of PC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(IC(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 rc(t="."){let e=Oo(t,"spec","features");if(!zp(e))return!1;let r=[];for(let i of CC(e).sort())if(!(!i.endsWith(".yaml")&&!i.endsWith(".yml")))try{let o=(0,dS.parse)(PC(Oo(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 aY(To(t,"spec","index.yaml"),n,"utf8"),!0}var dS,Up=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as cY,readFileSync as lY,readdirSync as gPe}from"node:fs";import{join as CC}from"node:path";function yPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=uY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return DC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...DC(e),{detector:qp,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 uY){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:qp,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(...DC(e)),o}function DC(t){let e=CC(t,"spec","index.yaml"),r=CC(t,"spec","features");if(!cY(e)||!cY(r))return[];let n=new Map;try{for(let l of lY(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 gPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=lY(CC(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:qp,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:qp,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 qp,uY,dY,fY=y(()=>{"use strict";Up();Ue();qp="INVENTORY_DRIFT",uY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];dY={name:qp,run:yPe}});import{existsSync as _Pe,readFileSync as bPe}from"node:fs";import{join as vPe}from"node:path";function wPe(t){let{cwd:e="."}=t,r=vPe(e,"src","spec","schema.json"),n=[];if(_Pe(r)){let i;try{i=JSON.parse(bPe(r,"utf8"))}catch(o){n.push({detector:Hp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of SPe)i.required?.includes(o)||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==pY&&n.push({detector:Hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${pY}'`})}catch{}return n}var Hp,SPe,pY,mY,hY=y(()=>{"use strict";Ue();Hp="META_INTEGRITY",SPe=["schema","project","features"],pY="0.1";mY={name:Hp,run:wPe}});function xPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return gY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),gY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function gY(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:yY,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 yY,_Y,bY=y(()=>{"use strict";Ue();yY="SLUG_CONFLICT";_Y={name:yY,run:xPe}});function iu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as $Pe}from"node:fs";import{join as kPe}from"node:path";function EPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>APe(r,e))}function APe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=kPe(e,i);$Pe(o)||r.push(TPe(n.id,i,n.status))}return r}function TPe(t,e,r){return iu(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,NC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:EPe}});function OPe(t){let{cwd:e="."}=t;return ye(e,jC,RPe)}function RPe(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:jC,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 jC,hS,MC=y(()=>{"use strict";xt();jC="MISSING_TESTS";hS={name:jC,run:OPe}});import{existsSync as IPe,readFileSync as PPe}from"node:fs";import{join as vY}from"node:path";function SY(t){if(IPe(t))try{return JSON.parse(PPe(t,"utf8"))}catch{return}}function jPe(t){let{cwd:e="."}=t,r=SY(vY(e,CPe)),n=SY(vY(e,DPe));if(!r||!n)return[{detector:FC,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>NPe&&i.push({detector:FC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var FC,CPe,DPe,NPe,wY,xY=y(()=>{"use strict";FC="PERFORMANCE_DRIFT",CPe="perf/baseline.json",DPe="perf/current.json",NPe=10;wY={name:FC,run:jPe}});import{existsSync as MPe}from"node:fs";import{join as FPe}from"node:path";function zPe(t){let{cwd:e="."}=t;return ye(e,LC,r=>qPe(r,e))}function UPe(t,e){return(t.modules??[]).some(r=>MPe(FPe(e,r)))}function qPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||UPe(s,e)||r.push(s.id);let n=LPe;if(r.length<=n)return[];let i=r.slice(0,$Y).join(", "),o=r.length>$Y?", \u2026":"";return[{detector:LC,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 LC,LPe,$Y,kY,EY=y(()=>{"use strict";xt();LC="PLANNED_BACKLOG",LPe=5,$Y=8;kY={name:LC,run:zPe}});import{existsSync as HPe,readFileSync as BPe}from"node:fs";import{join as GPe}from"node:path";function WPe(t){let{cwd:e="."}=t;return ye(e,zC,r=>KPe(r,e))}function KPe(t,e){if(t.features.lengthn.includes(i))?[{detector:zC,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 zC,ZPe,VPe,AY,TY=y(()=>{"use strict";xt();zC="PROJECT_CONTEXT_DRIFT",ZPe=8,VPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];AY={name:zC,run:WPe}});function OY(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,YPe)}function YPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...OY(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(...OY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,UC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:JPe}});function Bp(t=""){return new RegExp(XPe,t)}var XPe,qC=y(()=>{"use strict";XPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as QPe,readdirSync as eCe,readFileSync as tCe,statSync as rCe,writeFileSync as nCe}from"node:fs";import{dirname as iCe,join as Gp,normalize as oCe,relative as sCe}from"node:path";function dCe(t){let e=[];for(let r of t.matchAll(uCe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Bp("g"))??[])e.push(n);return[...new Set(e)].sort()}function fCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function RY(t){return t.split("\\").join("/")}function pCe(t){return aCe.some(e=>t===e||t.startsWith(`${e}/`))}function mCe(t){let e=Gp(t,"docs");if(!QPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=eCe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Gp(i,s),c;try{c=rCe(a)}catch{continue}let l=RY(sCe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function hCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=oCe(Gp(iCe(t),e));return RY(r)}function Zp(t="."){let e=[];for(let r of mCe(t)){let n;try{n=tCe(Gp(t,r),"utf8")}catch{continue}let i=fCe(n),o=dCe(i);if(pCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(cCe)?[]:i.match(Bp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(lCe)){let d=hCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function IY(t="."){let e=Zp(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 nCe(Gp(t,"spec","_doc-links.yaml"),`${r.join(` +`;return aY(Oo(t,"spec","index.yaml"),n,"utf8"),!0}var dS,Up=y(()=>{"use strict";dS=wt(tr(),1)});import{existsSync as cY,readFileSync as lY,readdirSync as gPe}from"node:fs";import{join as DC}from"node:path";function yPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=xs(e),i=r.inventory;if(!i){let s=uY.filter(([c])=>(n[c]??0)>0);if(s.length===0)return NC(e);let a=s.map(([c,l])=>`${n[c]??0} ${l}`).join(", ");return[...NC(e),{detector:qp,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 uY){let c=i[s]??0,l=n[s]??0;c!==l&&o.push({detector:qp,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(...NC(e)),o}function NC(t){let e=DC(t,"spec","index.yaml"),r=DC(t,"spec","features");if(!cY(e)||!cY(r))return[];let n=new Map;try{for(let l of lY(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 gPe(r)){if(!l.endsWith(".yaml")&&!l.endsWith(".yml"))continue;let u=lY(DC(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:qp,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:qp,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 qp,uY,dY,fY=y(()=>{"use strict";Up();Ue();qp="INVENTORY_DRIFT",uY=[["features","feature shard(s)"],["scenarios","scenario shard(s)"],["capabilities","capabilit(ies)"],["test_files","test file(s)"]];dY={name:qp,run:yPe}});import{existsSync as _Pe,readFileSync as bPe}from"node:fs";import{join as vPe}from"node:path";function wPe(t){let{cwd:e="."}=t,r=vPe(e,"src","spec","schema.json"),n=[];if(_Pe(r)){let i;try{i=JSON.parse(bPe(r,"utf8"))}catch(o){n.push({detector:Hp,severity:"error",message:`spec/schema.json unreadable or invalid JSON: ${o.message}`})}if(i)for(let o of SPe)i.required?.includes(o)||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not require root key '${o}'`}),i.properties?.[o]||n.push({detector:Hp,severity:"error",message:`spec/schema.json does not declare property '${o}'`})}try{let i=q(e);i.schema!==pY&&n.push({detector:Hp,severity:"error",message:`spec.yaml schema='${i.schema}' but supported version is '${pY}'`})}catch{}return n}var Hp,SPe,pY,mY,hY=y(()=>{"use strict";Ue();Hp="META_INTEGRITY",SPe=["schema","project","features"],pY="0.1";mY={name:Hp,run:wPe}});function xPe(t){let{cwd:e="."}=t,r;try{r=q(e)}catch{return[]}let n=[];return gY(r.features.map(i=>({id:i.id,slug:i.slug})),"features",n),gY((r.scenarios??[]).map(i=>({id:i.id,slug:i.slug})),"scenarios",n),n}function gY(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:yY,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 yY,_Y,bY=y(()=>{"use strict";Ue();yY="SLUG_CONFLICT";_Y={name:yY,run:xPe}});function iu(t){return t==="planned"||t==="in_progress"}var fS=y(()=>{"use strict"});import{existsSync as $Pe}from"node:fs";import{join as kPe}from"node:path";function EPe(t){let{cwd:e="."}=t;return ye(e,pS,r=>APe(r,e))}function APe(t,e){let r=[];for(let n of t.features)for(let i of n.modules??[]){let o=kPe(e,i);$Pe(o)||r.push(OPe(n.id,i,n.status))}return r}function OPe(t,e,r){return iu(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,jC=y(()=>{"use strict";fS();xt();pS="MISSING_IMPLEMENTATION";mS={name:pS,run:EPe}});function TPe(t){let{cwd:e="."}=t;return ye(e,MC,RPe)}function RPe(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:MC,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 MC,hS,FC=y(()=>{"use strict";xt();MC="MISSING_TESTS";hS={name:MC,run:TPe}});import{existsSync as IPe,readFileSync as PPe}from"node:fs";import{join as vY}from"node:path";function SY(t){if(IPe(t))try{return JSON.parse(PPe(t,"utf8"))}catch{return}}function jPe(t){let{cwd:e="."}=t,r=SY(vY(e,CPe)),n=SY(vY(e,DPe));if(!r||!n)return[{detector:LC,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>NPe&&i.push({detector:LC,severity:"warn",message:`${o} regressed ${c.toFixed(1)}% (baseline ${s.value}${s.unit??""} \u2192 current ${a.value}${a.unit??""})`})}return i}var LC,CPe,DPe,NPe,wY,xY=y(()=>{"use strict";LC="PERFORMANCE_DRIFT",CPe="perf/baseline.json",DPe="perf/current.json",NPe=10;wY={name:LC,run:jPe}});import{existsSync as MPe}from"node:fs";import{join as FPe}from"node:path";function zPe(t){let{cwd:e="."}=t;return ye(e,zC,r=>qPe(r,e))}function UPe(t,e){return(t.modules??[]).some(r=>MPe(FPe(e,r)))}function qPe(t,e){let r=[];for(let s of t.features)s.status!=="planned"&&s.status!=="in_progress"||UPe(s,e)||r.push(s.id);let n=LPe;if(r.length<=n)return[];let i=r.slice(0,$Y).join(", "),o=r.length>$Y?", \u2026":"";return[{detector:zC,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 zC,LPe,$Y,kY,EY=y(()=>{"use strict";xt();zC="PLANNED_BACKLOG",LPe=5,$Y=8;kY={name:zC,run:zPe}});import{existsSync as HPe,readFileSync as BPe}from"node:fs";import{join as GPe}from"node:path";function WPe(t){let{cwd:e="."}=t;return ye(e,UC,r=>KPe(r,e))}function KPe(t,e){if(t.features.lengthn.includes(i))?[{detector:UC,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 UC,ZPe,VPe,AY,OY=y(()=>{"use strict";xt();UC="PROJECT_CONTEXT_DRIFT",ZPe=8,VPe=["Refine by hand or re-run with LLM available","What gap or pain led to this project","What does success look like"];AY={name:UC,run:WPe}});function TY(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,YPe)}function YPe(t){let e=new Set(t.features.map(n=>n.id)),r=[];for(let n of t.features)r.push(...TY(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(...TY(e,n.features,`scenario ${n.id}.features`));return r}var gS,yS,qC=y(()=>{"use strict";xt();gS="REFERENCE_INTEGRITY";yS={name:gS,run:JPe}});function Bp(t=""){return new RegExp(XPe,t)}var XPe,HC=y(()=>{"use strict";XPe=String.raw`\bF-(?:\d{3,}|[0-9a-f]{6,8})\b`});import{existsSync as QPe,readdirSync as eCe,readFileSync as tCe,statSync as rCe,writeFileSync as nCe}from"node:fs";import{dirname as iCe,join as Gp,normalize as oCe,relative as sCe}from"node:path";function dCe(t){let e=[];for(let r of t.matchAll(uCe))if(!r[1].trim().startsWith("ignore"))for(let n of r[1].match(Bp("g"))??[])e.push(n);return[...new Set(e)].sort()}function fCe(t){return t.replace(/```[\s\S]*?```/g," ").replace(/~~~[\s\S]*?~~~/g," ").replace(/`[^`\n]*`/g," ")}function RY(t){return t.split("\\").join("/")}function pCe(t){return aCe.some(e=>t===e||t.startsWith(`${e}/`))}function mCe(t){let e=Gp(t,"docs");if(!QPe(e))return[];let r=[],n=[e];for(;n.length>0;){let i=n.pop(),o;try{o=eCe(i)}catch{continue}for(let s of o){if(s.startsWith("."))continue;let a=Gp(i,s),c;try{c=rCe(a)}catch{continue}let l=RY(sCe(t,a));c.isDirectory()?n.push(a):s.endsWith(".md")&&r.push(l)}}return r.sort()}function hCe(t,e){if(/^[a-z]+:/i.test(e))return null;let r=oCe(Gp(iCe(t),e));return RY(r)}function Zp(t="."){let e=[];for(let r of mCe(t)){let n;try{n=tCe(Gp(t,r),"utf8")}catch{continue}let i=fCe(n),o=dCe(i);if(pCe(r)){if(o.length===0)continue;e.push({doc:r,features:o,doc_links:[]});continue}let a=n.includes(cCe)?[]:i.match(Bp("g"))??[],c=[...new Set([...a,...o])].sort(),l=new Set;for(let u of i.matchAll(lCe)){let d=hCe(r,u[1]);d&&l.add(d)}e.push({doc:r,features:c,doc_links:[...l].sort()})}return{docs:e}}function IY(t="."){let e=Zp(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 nCe(Gp(t,"spec","_doc-links.yaml"),`${r.join(` `)} -`,"utf8"),!0}var aCe,cCe,lCe,uCe,_S=y(()=>{"use strict";qC();aCe=["docs/ab-evaluation","docs/ab-evaluation-extended","docs/dogfood","docs/benchmarks"],cCe="clad-doc-links: ignore",lCe=/\]\(\s*([^)\s]+?\.md)(?:#[^)]*)?\s*\)/g,uCe=/clad-doc-links:[ \t]*([^\n>]*)/g});import{existsSync as gCe}from"node:fs";import{join as yCe}from"node:path";function _Ce(t){let{cwd:e="."}=t;return ye(e,bS,r=>bCe(r,e))}function bCe(t,e){let r=new Set((t.features??[]).map(i=>i.id)),n=[];for(let i of Zp(e).docs){for(let o of i.doc_links)gCe(yCe(e,o))||n.push({detector:bS,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:bS,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 bS,vS,HC=y(()=>{"use strict";_S();xt();bS="DOC_LINK_INTEGRITY";vS={name:bS,run:_Ce}});function vCe(t){let{cwd:e="."}=t;return ye(e,Vp,r=>SCe(r))}function SCe(t){let e=[],r=t.features.length,n=t.scenarios??[],i=r>=PY,o=t.project.onboarding_seeded===!0&&!i;r>=PY&&n.length===0&&e.push({detector:Vp,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:Vp,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:Vp,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 Vp,PY,CY,DY=y(()=>{"use strict";xt();Vp="SCENARIO_COVERAGE",PY=8;CY={name:Vp,run:vCe}});import{createHash as wCe}from"node:crypto";function xCe(t){return!Number.isFinite(t)||t<=0?0:t>=1?1:t}function Wp(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??NY),sample:xCe(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(NY),sample:0}:{mandateActive:!1,reportOnly:!1,exhaustive:!1,alwaysEars:new Set,sample:0}}function Kp(t){return(t.features??[]).filter(e=>e.status==="done").length}function $Ce(t,e){return e<=0?!1:e>=1?!0:parseInt(wCe("sha256").update(t).digest("hex").slice(0,8),16)%1e40})}return r}var NY,SS=y(()=>{"use strict";NY=["unwanted"]});import{chmodSync as kCe,existsSync as MY,readFileSync as ECe,readdirSync as ACe,statSync as FY,unlinkSync as TCe,utimesSync as OCe,writeFileSync as RCe}from"node:fs";import{join as LY}from"node:path";import zY from"node:process";function ICe(t){return OJ(t).map(e=>{try{let r=FY(e);return r.isFile()?{path:e,body:ECe(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 PCe(t){let e=[];for(let r of t)if(!r.nonFile)try{if(r.body===void 0){if(!MY(r.path))continue;if(!FY(r.path).isFile()){e.push(`${r.path}: scoped oracle run created a non-file report candidate`);continue}TCe(r.path);continue}RCe(r.path,r.body),r.mode!==void 0&&kCe(r.path,r.mode),r.atime&&r.mtime&&OCe(r.path,r.atime,r.mtime)}catch(n){e.push(`${r.path}: ${n.message}`)}return e}function CCe(t){let e=!1,r=n=>{for(let i of ACe(n,{withFileTypes:!0})){if(e)return;let o=LY(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 BC(t={}){let{cwd:e="."}=t,r=LY(e,$s);if(!MY(r)||!CCe(r))return{stage:nc,pass:!1,exitCode:2,stderr:`no spec-conformance oracles under ${$s}/ \u2014 skipped`};let n=_t(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=ICe(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=PCe(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,DCe,GC=y(()=>{"use strict";zr();Dn();Sp();Nn();nc="stage_2.3",$s="tests/oracle";DCe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${zY.argv[1]}`;if(DCe){let t=BC();console.log(JSON.stringify(t)),zY.exit(t.exitCode)}});import{existsSync as NCe}from"node:fs";import{join as jCe}from"node:path";function MCe(t){let{cwd:e="."}=t;return ye(e,ai,r=>FCe(r,e))}function FCe(t,e){let r=[],n=Wp(t.project,Kp(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(Jp(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(!NCe(jCe(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,UY,qY=y(()=>{"use strict";un();SS();GC();xt();ai="SPEC_CONFORMANCE";UY={name:ai,run:MCe}});function LCe(t){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return[{detector:ZC,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>HY&&i.push({detector:ZC,severity:"warn",message:`evidence ${o.id} is ${Math.round(a)} days old (floor ${HY})`})}return i}var ZC,HY,BY,GY=y(()=>{"use strict";un();ZC="STALE_EVIDENCE",HY=90;BY={name:ZC,run:LCe}});import{existsSync as ZY}from"node:fs";import{join as VY}from"node:path";function zCe(t){let{cwd:e="."}=t;return ye(e,ou,r=>UCe(r,e))}function UCe(t,e){let r=[];for(let n of t.features){if(n.archived_at&&n.status!=="archived"&&r.push({detector:ou,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:ou,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=>ZY(VY(e,o)));i.length>0&&r.push({detector:ou,severity:"warn",message:`feature ${n.id} is archived but ${i.length} module(s) still exist: ${i.join(", ")}`})}iu(n.status)&&(n.modules?.length??0)>0&&!(n.modules??[]).some(i=>ZY(VY(e,i)))&&r.push({detector:ou,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 ou,wS,VC=y(()=>{"use strict";fS();xt();ou="STALE_SPECIFICATION";wS={name:ou,run:zCe}});import{existsSync as WY,statSync as KY}from"node:fs";import{join as JY}from"node:path";function HCe(t,e){let r=0;for(let n of e){let i=JY(t,n);if(!WY(i))continue;let o=KY(i).mtimeMs;o>r&&(r=o)}return r}function BCe(t){let{cwd:e="."}=t;return ye(e,WC,r=>GCe(r,e))}function GCe(t,e){let r=Li(e,t.project?.language),n=t.features.flatMap(a=>a.modules??[]),i=HCe(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=JY(e,a);if(!WY(c))continue;let l=KY(c).mtimeMs,u=(i-l)/(1e3*60*60*24);u>qCe&&s.push({detector:WC,severity:"warn",path:a,message:`${a} is ${Math.round(u)} days older than newest source module`})}return s}var WC,qCe,xS,KC=y(()=>{"use strict";Rp();Va();xt();WC="STALE_TESTS",qCe=30;xS={name:WC,run:BCe}});import{existsSync as ZCe}from"node:fs";import{join as VCe}from"node:path";function WCe(t){let{cwd:e="."}=t;return ye(e,Yp,r=>KCe(r,e))}function KCe(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:Yp,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=>!ZCe(VCe(e,a)));s.length!==0&&(n.status==="done"?r.push({detector:Yp,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:Yp,severity:iu(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 Yp,$S,JC=y(()=>{"use strict";fS();xt();Yp="STATUS_DRIFT";$S={name:Yp,run:WCe}});import{readdirSync as JCe}from"node:fs";import{extname as YCe,join as XCe}from"node:path";function XY(t){return t.maxFiles!==void 0&&t.maxFiles>=1?t.maxFiles:eDe}function QY(t,e,r){let n=0,i=[t];for(;i.length>0&&n=e)break;n+=1,r(YCe(a.name).toLowerCase())}}}}function eX(t,e={}){let r={},n=0;QY(t,XY(e),s=>{let a=ic[s];a!==void 0&&(r[a]=(r[a]??0)+1,n+=1)});let i=Object.keys(r).sort(),o=null;for(let s of i)(o===null||r[s]>r[o])&&(o=s);return{counts:r,classified:n,set:i,dominant:o,share(s){return n===0?0:(r[s]??0)/n}}}function tX(t,e={}){let r=new Set;return QY(t,XY(e),n=>{ic[n]!==void 0&&r.add(n)}),[...r].sort()}var ic,YY,QCe,eDe,kS=y(()=>{"use strict";ic={".ts":"typescript",".tsx":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".go":"go",".rs":"rust",".java":"java",".kt":"kotlin",".kts":"kotlin",".cs":"csharp",".rb":"ruby",".php":"php",".swift":"swift",".ex":"elixir",".exs":"elixir",".scala":"scala",".dart":"dart",".cpp":"cpp",".cc":"cpp",".cxx":"cpp",".hpp":"cpp",".h":"cpp"},YY=new Set(Object.values(ic)),QCe=new Set(["node_modules",".git","dist","build","out","coverage","target","vendor",".cladding"]),eDe=2e4});function nDe(t){let{cwd:e="."}=t;return ye(e,ES,r=>oDe(r,e))}function iDe(t){return`{${Object.keys(t).sort((r,n)=>t[n]-t[r]||r.localeCompare(n)).map(r=>`${r} \xD7${t[r]}`).join(", ")}}`}function oDe(t,e){let r=t.project?.language??"";if(!YY.has(r))return[];let n=eX(e);return n.classified{"use strict";kS();xt();ES="TECH_STACK_MISMATCH",tDe=5,rDe=.1;rX={name:ES,run:nDe}});import{extname as sDe}from"node:path";function uDe(t,e){let r=new Map,n=new Map,i=0;for(let a of t.features??[])for(let c of a.modules??[]){let l=c.split("/"),u=l.findIndex((m,h)=>h0?n.roots:[cDe],o=new Set([...tX(e),...n.extensions]),s=new Set;for(let a of i){let c=a===""?"":`${a}/`;for(let l of r)for(let u of o)s.add(`${c}${l}/**/*${u}`)}return[...s].sort()}function fDe(t){let{cwd:e="."}=t;return ye(e,YC,r=>pDe(r,e))}function pDe(t,e){let r=new Set;for(let s of t.features)for(let a of s.modules??[])r.add(a);let n=dDe(t,e),i=n.length===0?[]:vs([...n],{cwd:e,dot:!1}),o=[];for(let s of i)r.has(s)||o.push({detector:YC,severity:"error",path:s,message:`file '${s}' is not claimed by any feature in spec.yaml`});return o}var YC,iX,aDe,cDe,lDe,AS,XC=y(()=>{"use strict";Rp();kS();oC();xt();YC="UNMAPPED_ARTIFACT",iX=["src/stages/**/*.ts","src/spec/**/*.ts"],aDe=8,cDe="src",lDe=.25;AS={name:YC,run:fDe}});import{existsSync as oX}from"node:fs";import{join as sX}from"node:path";function hDe(t){return mDe.some(e=>t.startsWith(e))}function gDe(t){let{cwd:e="."}=t;return ye(e,QC,r=>yDe(r,e))}function yDe(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(hDe(o))continue;let s=o.split("#",1)[0];oX(sX(e,o))||s&&oX(sX(e,s))||r.push({detector:QC,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: +`)}`)}return o}function tre(t,e){return t.kind.localeCompare(e.kind)||t.other.localeCompare(e.other)}import{readFileSync as W4e}from"node:fs";import{dirname as K4e,join as Vj}from"node:path";import{fileURLToPath as J4e}from"node:url";var Wj=K4e(J4e(import.meta.url));function ore(t){for(let e of[Vj(Wj,"viewer",t),Vj(Wj,"..","graph","viewer",t),Vj(Wj,"..","..","dist","viewer",t)])try{return W4e(e,"utf8")}catch{}throw new Error(`cladding: viewer asset not found: ${t}`)}function sre(t){return JSON.stringify(t).replace(/0?` `:"";return` @@ -927,21 +927,21 @@ ${n.report.remainingQuestions} question(s) left. continue with \`clad clarify ${n} -`}lC();HC();NC();MC();UC();cC();KC();JC();XC();eD();oh();qC();Ue();var Z4e=[hS,TS,mS,AS,yS,vS,tS,$S,xS,eS];function V4e(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=Bp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Jx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Ta(e,q(e))}catch{}try{for(let o of Z4e){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 V4e(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}Kj();Ue();Pi();var K4e=new Set(["mermaid","dot","json","obsidian","html"]);function cre(t={}){try{let e=t.format??"mermaid";if(!K4e.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=Ac(n,".");if(t.focus){let s=Bx(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=Hx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ire(i);for(let[c,l]of a){let u=W4e(s,c);Jj(Xj(u),{recursive:!0}),Yj(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=Kx(i,Jx(i,"."));Jj(Xj(t.out),{recursive:!0}),Yj(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"?nre(i):r==="json"?Wx(i):rre(i);t.out?(Jj(Xj(t.out),{recursive:!0}),Yj(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 lre(){try{let t=Ac(q(),".");process.stdout.write(are(Yx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as J4e}from"node:http";import{existsSync as Y4e,watch as X4e}from"node:fs";import{join as Q4e}from"node:path";Ue();Pi();function eHe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ac(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh +`}uC();BC();jC();FC();qC();lC();JC();YC();XC();eD();oh();HC();Ue();var Y4e=[hS,TS,mS,OS,yS,vS,tS,$S,xS,eS];function X4e(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=Bp().exec(t.message??"");return r&&e.has(qe.feature(r[0]))?[qe.feature(r[0])]:[]}function Yx(t,e="."){let r=new Set(t.nodes.map(o=>o.id)),n={};try{Oa(e,q(e))}catch{}try{for(let o of Y4e){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 X4e(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}Kj();Ue();Pi();var eHe=new Set(["mermaid","dot","json","obsidian","html"]);function cre(t={}){try{let e=t.format??"mermaid";if(!eHe.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=Ac(n,".");if(t.focus){let s=Gx(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=Bx(i,s,a)}if(r==="obsidian"){let s=t.out??".cladding/graph",a=ire(i);for(let[c,l]of a){let u=Q4e(s,c);Jj(Xj(u),{recursive:!0}),Yj(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=Jx(i,Yx(i,"."));Jj(Xj(t.out),{recursive:!0}),Yj(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"?nre(i):r==="json"?Kx(i):rre(i);t.out?(Jj(Xj(t.out),{recursive:!0}),Yj(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 lre(){try{let t=Ac(q(),".");process.stdout.write(are(Xx(t)),()=>process.exit(0))}catch(t){L("fail","graph",t.message),process.exit(1)}}oh();import{createServer as tHe}from"node:http";import{existsSync as rHe,watch as nHe}from"node:fs";import{join as iHe}from"node:path";Ue();Pi();function oHe(t={}){let e=t.cwd??".",r=new Set,n=()=>Ac(q(e),e),i=()=>{for(let u of r)try{u.write(`data: refresh -`)}catch{r.delete(u)}},o=J4e((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=Wx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Jx(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 +`)}catch{r.delete(u)}},o=tHe((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=Kx(n());d.writeHead(200,{"Content-Type":"application/json","Cache-Control":"no-store"}),d.end(m);return}if(f==="/health.json"){let m=JSON.stringify(Yx(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=Kx(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=Q4e(e,u);if(Y4e(d))try{let f=X4e(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 +`),r.add(d),u.on("close",()=>r.delete(d));return}if(f==="/"||f==="/index.html"){let m=Jx(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=iHe(e,u);if(rHe(d))try{let f=nHe(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 ure(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await eHe({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 tHe=["stage_1.1","stage_2.1","stage_2.3"];function rHe(t){return(t.features??[]).filter(e=>e.status==="done")}function nHe(t,e){let r=rHe(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 dre(t,e){let r=[];for(let n of tHe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=nHe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}DS();import fre from"node:process";function iHe(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 Xx(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=iHe(n,t);i.pass||r.push(i)}return r}un();var Qj="stage_4.1";function eM(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Qj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Xx(r);if(n.length===0)return{stage:Qj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Qj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var oHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(oHe){let t=eM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}Al();import{randomBytes as sHe}from"node:crypto";import{unlinkSync as aHe}from"node:fs";import{tmpdir as cHe}from"node:os";import{join as lHe,resolve as tM}from"node:path";import uHe from"node:process";var Gr=null;function pre(t){Gr={cwd:tM(t),run:null,jsonFile:null}}function rM(){return Gr!==null}function nM(t,e){if(!Gr||Gr.cwd!==tM(t))return null;if(Gr.run)return Gr.run;let r=lHe(cHe(),`clad-shared-vitest-${uHe.pid}-${sHe(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function mre(t){return!Gr||Gr.cwd!==tM(t)?null:Gr.run}function iM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function hre(){let t=Gr?.jsonFile;if(Gr=null,t)try{aHe(t)}catch{}}zr();import gre from"node:process";var Qx="stage_1.4";function oM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:Qx,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:Qx,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:Qx,pass:!0,exitCode:0}:{stage:Qx,pass:!1,exitCode:1,stderr:`working tree dirty: -${n}`}}var dHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(dHe){let t=oM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}zr();import yre from"node:process";sh();Nn();var e0="stage_2.2";function sM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:e0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:e0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(e0,r,s,n);return a||Xt(e0,s)}var mHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yre.argv[1]}`;if(mHe){let t=sM();console.log(JSON.stringify(t)),yre.exit(t.exitCode)}Qp();aD();aM();zr();Dn();Nn();import bre from"node:process";var n0="stage_3.2";function cM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:n0,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:n0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(n0,i,s,o);return a||Xt(n0,s)}var DHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(DHe){let t=cM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as NHe}from"node:fs";import{resolve as Sre}from"node:path";import wre from"node:process";var fi="stage_2.4",lM=5e3,jHe=3e4;function uM(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 FHe(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=Sre(e,r.path);if(!NHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??lM,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 vre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},MHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function FHe(t,e,r){let n=Math.min(e.length*lM,jHe),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(LHe(t,s,r))}return zHe(o)}function LHe(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("/")?Sre(t,a):a,u=lM,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 zHe(t){let e="skip";for(let o of t)vre[o.disposition]>vre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${MHe[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 UHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(UHe){let t=uM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}zr();Dn();Nn();import xre from"node:process";var i0="stage_3.1";function dM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:i0,pass:!1,exitCode:2,stderr:"smoke npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var qHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xre.argv[1]}`;if(qHe){let t=dM();console.log(JSON.stringify(t)),xre.exit(t.exitCode)}GC();fM();pM();zr();t0();import{randomBytes as KHe}from"node:crypto";import{unlinkSync as JHe}from"node:fs";import{tmpdir as YHe}from"node:os";import{join as XHe}from"node:path";import hM from"node:process";sh();Nn();Ue();import{readFileSync as GHe}from"node:fs";import{resolve as Ere}from"node:path";function ZHe(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=Ere(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 VHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function WHe(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=VHe(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(Ere(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 mM(t,e){try{let r=ZHe(GHe(t,"utf8"));return r?WHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function Are(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Tre(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Ore(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 QHe(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Are(n,i))return null;let o=n,s=i,a=nM(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(iM(u)==="fallback")return null;if(r){let d=mM(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 e6e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Tre(n,i))return null;let o=n,s=i,a=nM(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(iM(c)==="fallback")return null;if(r&&Ore(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 gM(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=Are(n,i),a=Tre(n,i),c=r&&s;if(rM()&&s){let d=QHe(t,e,c);if(d)return d}if(rM()&&a){let d=e6e(t,e);if(d)return d}let l,u=i;c&&(l=XHe(YHe(),`clad-vitest-${hM.pid}-${KHe(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&&Ore(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=mM(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{JHe(l)}catch{}}}var t6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hM.argv[1]}`;if(t6e){let t=gM();console.log(JSON.stringify(t)),hM.exit(t.exitCode)}zr();Dn();Nn();import Rre from"node:process";var a0="stage_3.3";function yM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:a0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:a0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(a0,i,s,o);return a||Xt(a0,s)}var r6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rre.argv[1]}`;if(r6e){let t=yM();console.log(JSON.stringify(t)),Rre.exit(t.exitCode)}VC();Zf();wa();bM();Up();_S();var Mre=wt(tr(),1);import{existsSync as vM,readFileSync as p6e,readdirSync as jre,statSync as m6e,writeFileSync as h6e}from"node:fs";import{basename as dh,join as fh,relative as Nre}from"node:path";var g6e=["self-dogfood:","fixture:","derived:"],Fre=/\.(test|spec)\.[jt]sx?$/;function Lre(t,e=t,r=[]){let n;try{n=jre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{m6e(o).isDirectory()?Lre(t,o,r):Fre.test(i)&&r.push(o)}catch{continue}}return r}function zre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!vM(e)||!vM(r))return{repaired:n,suggested:i};let o=Lre(r),s=new Map;for(let a of o){let c=Nre(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of jre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=p6e(c,"utf8"),u=(0,Mre.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(g6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(vM(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=>Nre(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Fre,"");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 ure(t={}){let e=t.port!==void 0?Number(t.port):3e3;try{let r=await oHe({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 sHe=["stage_1.1","stage_2.1","stage_2.3"];function aHe(t){return(t.features??[]).filter(e=>e.status==="done")}function cHe(t,e){let r=aHe(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 dre(t,e){let r=[];for(let n of sHe){if(!e.some(s=>s.stage===n&&s.status==="skip"))continue;let o=cHe(t,n);o&&r.push({stage:n,label:"Verification",message:o})}return r}NS();import fre from"node:process";function lHe(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 Qx(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=lHe(n,t);i.pass||r.push(i)}return r}un();var Qj="stage_4.1";function eM(t={}){let{cwd:e="."}=t,r=pr(e);if(r.length===0)return{stage:Qj,pass:!1,exitCode:2,stderr:"no audit log present \u2014 record evidence before running stage_4.1"};let n=Qx(r);if(n.length===0)return{stage:Qj,pass:!0,exitCode:0};let i=n.map(o=>`${o.acId}: ${o.reason}`).join("; ");return{stage:Qj,pass:!1,exitCode:1,stderr:`anti-self-cert guard: ${i}`}}var uHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${fre.argv[1]}`;if(uHe){let t=eM();console.log(JSON.stringify(t)),fre.exit(t.exitCode)}Al();import{randomBytes as dHe}from"node:crypto";import{unlinkSync as fHe}from"node:fs";import{tmpdir as pHe}from"node:os";import{join as mHe,resolve as tM}from"node:path";import hHe from"node:process";var Gr=null;function pre(t){Gr={cwd:tM(t),run:null,jsonFile:null}}function rM(){return Gr!==null}function nM(t,e){if(!Gr||Gr.cwd!==tM(t))return null;if(Gr.run)return Gr.run;let r=mHe(pHe(),`clad-shared-vitest-${hHe.pid}-${dHe(6).toString("hex")}.json`);Gr.jsonFile=r;let n=e(r);return Gr.run={proc:n,jsonFile:r},Gr.run}function mre(t){return!Gr||Gr.cwd!==tM(t)?null:Gr.run}function iM(t){return t.pass&&t.exitCode===0?"reuse-pass":"fallback"}function hre(){let t=Gr?.jsonFile;if(Gr=null,t)try{fHe(t)}catch{}}zr();import gre from"node:process";var e0="stage_1.4";function oM(t={}){let{cwd:e="."}=t,r;try{r=Ke("git",["status","--porcelain"],{cwd:e,reject:!1})}catch(i){if(i.code==="ENOENT")return{stage:e0,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:e0,pass:!1,exitCode:2,stderr:i}}let n=(r.stdout??"").toString().trim();return n.length===0?{stage:e0,pass:!0,exitCode:0}:{stage:e0,pass:!1,exitCode:1,stderr:`working tree dirty: +${n}`}}var gHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${gre.argv[1]}`;if(gHe){let t=oM();console.log(JSON.stringify(t)),gre.exit(t.exitCode)}zr();import yre from"node:process";sh();Nn();var t0="stage_2.2";function sM(t={}){let{cwd:e="."}=t,r,n,i;try{({cmd:r,args:n,language:i}=Xi("coverage",t))}catch(c){return{stage:t0,pass:!1,exitCode:1,stderr:c.message}}if(!r||!n)return{stage:t0,pass:!1,exitCode:2,stderr:`no coverage runner registered for language '${i}'`};let o=mre(e),s=o?o.proc:Ke(r,[...n],{cwd:e,reject:!1}),a=Nt(t0,r,s,n);return a||Xt(t0,s)}var bHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${yre.argv[1]}`;if(bHe){let t=sM();console.log(JSON.stringify(t)),yre.exit(t.exitCode)}Qp();aD();aM();zr();Dn();Nn();import bre from"node:process";var i0="stage_3.2";function cM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.perf,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:i0,pass:!1,exitCode:2,stderr:`no perf runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:i0,pass:!1,exitCode:2,stderr:"perf npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(i0,i,s,o);return a||Xt(i0,s)}var LHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${bre.argv[1]}`;if(LHe){let t=cM();console.log(JSON.stringify(t)),bre.exit(t.exitCode)}zr();Ue();Nn();import{existsSync as zHe}from"node:fs";import{resolve as Sre}from"node:path";import wre from"node:process";var fi="stage_2.4",lM=5e3,UHe=3e4;function uM(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 HHe(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=Sre(e,r.path);if(!zHe(s))return{stage:fi,pass:!1,exitCode:2,stderr:`deliverable '${r.path}' not found \u2014 see DELIVERABLE_INTEGRITY`};let a=r.timeout_ms??lM,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 vre={fail:5,advisory:4,pending_env:4,liveness:3,pass:2,na:1,skip:0},qHe={pass:"\u2713",fail:"\u2717",liveness:"liveness",na:"na",pending_env:"pending_env",advisory:"advisory",skip:"skip"};function HHe(t,e,r){let n=Math.min(e.length*lM,UHe),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(BHe(t,s,r))}return GHe(o)}function BHe(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("/")?Sre(t,a):a,u=lM,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 GHe(t){let e="skip";for(let o of t)vre[o.disposition]>vre[e]&&(e=o.disposition);let r=t.map(o=>{let s=o.why?` \xB7 ${o.why}`:"";return`${qHe[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 ZHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${wre.argv[1]}`;if(ZHe){let t=uM();console.log(JSON.stringify(t)),wre.exit(t.exitCode)}zr();Dn();Nn();import xre from"node:process";var o0="stage_3.1";function dM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.smoke,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:o0,pass:!1,exitCode:2,stderr:`no smoke runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:o0,pass:!1,exitCode:2,stderr:"smoke 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 VHe=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${xre.argv[1]}`;if(VHe){let t=dM();console.log(JSON.stringify(t)),xre.exit(t.exitCode)}ZC();fM();pM();zr();r0();import{randomBytes as e6e}from"node:crypto";import{unlinkSync as t6e}from"node:fs";import{tmpdir as r6e}from"node:os";import{join as n6e}from"node:path";import hM from"node:process";sh();Nn();Ue();import{readFileSync as JHe}from"node:fs";import{resolve as Ere}from"node:path";function YHe(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=Ere(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 XHe(t){let e=t.indexOf("#");return(e===-1?t:t.slice(0,e)).trim()}function QHe(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=XHe(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(Ere(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 mM(t,e){try{let r=YHe(JHe(t,"utf8"));return r?QHe(q(e),r,e):[]}catch{return[]}}var Zr="stage_2.1";function Are(t,e){return t==="vitest"||t.endsWith("/vitest")||e.includes("vitest")}function Ore(t,e){return[t,...e].some(r=>r==="pytest"||r.endsWith("/pytest"))}function Tre(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 i6e(t,e,r){let n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Are(n,i))return null;let o=n,s=i,a=nM(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(iM(u)==="fallback")return null;if(r){let d=mM(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 o6e(t,e){let{strict:r=!1}=t,n,i;try{({cmd:n,args:i}=Xi("coverage",t))}catch{return null}if(!n||!i||!Ore(n,i))return null;let o=n,s=i,a=nM(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(iM(c)==="fallback")return null;if(r&&Tre(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 gM(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=Are(n,i),a=Ore(n,i),c=r&&s;if(rM()&&s){let d=i6e(t,e,c);if(d)return d}if(rM()&&a){let d=o6e(t,e);if(d)return d}let l,u=i;c&&(l=n6e(r6e(),`clad-vitest-${hM.pid}-${e6e(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&&Tre(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=mM(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{t6e(l)}catch{}}}var s6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${hM.argv[1]}`;if(s6e){let t=gM();console.log(JSON.stringify(t)),hM.exit(t.exitCode)}zr();Dn();Nn();import Rre from"node:process";var c0="stage_3.3";function yM(t={}){let{cwd:e="."}=t,r=_t(e),n=r.gates.visual,i=t.cmd??n?.cmd,o=t.args??n?.args;if(!i||!o)return{stage:c0,pass:!1,exitCode:2,stderr:`no visual runner registered for language '${r.language}'`};if(i==="npm"&&o[0]==="run"&&!Jl(e,o[o.length-1]))return{stage:c0,pass:!1,exitCode:2,stderr:"visual npm script not defined"};let s=Ke(i,[...o],{cwd:e,reject:!1}),a=Nt(c0,i,s,o);return a||Xt(c0,s)}var a6e=!globalThis.__CLADDING_BUNDLED&&import.meta.url===`file://${Rre.argv[1]}`;if(a6e){let t=yM();console.log(JSON.stringify(t)),Rre.exit(t.exitCode)}WC();Zf();wa();bM();Up();_S();var Mre=wt(tr(),1);import{existsSync as vM,readFileSync as _6e,readdirSync as jre,statSync as b6e,writeFileSync as v6e}from"node:fs";import{basename as dh,join as fh,relative as Nre}from"node:path";var S6e=["self-dogfood:","fixture:","derived:"],Fre=/\.(test|spec)\.[jt]sx?$/;function Lre(t,e=t,r=[]){let n;try{n=jre(e)}catch{return r}for(let i of n){if(i.startsWith("."))continue;let o=fh(e,i);try{b6e(o).isDirectory()?Lre(t,o,r):Fre.test(i)&&r.push(o)}catch{continue}}return r}function zre(t="."){let e=fh(t,"spec","features"),r=fh(t,"tests"),n=[],i=[];if(!vM(e)||!vM(r))return{repaired:n,suggested:i};let o=Lre(r),s=new Map;for(let a of o){let c=Nre(t,a).split("\\").join("/"),l=s.get(dh(a))??[];l.push(c),s.set(dh(a),l)}for(let a of jre(e)){if(!a.endsWith(".yaml")&&!a.endsWith(".yml"))continue;let c=fh(e,a),l,u;try{l=_6e(c,"utf8"),u=(0,Mre.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(S6e.some(x=>g.startsWith(x)))continue;let b=g.split("#",1)[0];if(vM(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=>Nre(t,h).split("\\").join("/")).find(h=>{let g=dh(h).replace(Fre,"");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&&h6e(c,l,"utf8")}return{repaired:n,suggested:i}}El();import{existsSync as y6e,readFileSync as _6e}from"node:fs";import{join as b6e}from"node:path";function v6e(t,e){let r=b6e(t,e);if(!y6e(r))return[];let n=[];for(let i of _6e(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 Ure(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=>v6e(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 qre(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();un();Pi();un();El();var SM=["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"],S6e=[...SM,"att"];function w6e(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 Xx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function x6e(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 d0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...SM.map(o=>w6e(i,o,e)),x6e(i,r,e)]}));return{columns:S6e,rows:n}}function Hre(t,e=".",r={}){let n=r.internal??!1,i=d0(t,e),o=[...SM.map(c=>n?c.replace("stage_",""):$6e(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 $6e(t){return Ra(t).slice(0,3)}async function tXe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(nfe(),rfe)),Promise.resolve().then(()=>(cfe(),afe)),Promise.resolve().then(()=>(lm(),_Q))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Wte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Zte(s,a,c),initialize:jj,prepareClarify:(s,{cwd:a})=>Vte(a,s),clarify:zj,resolveReview:(s,{cwd:a})=>qte(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 rXe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await jj({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)} +${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&v6e(c,l,"utf8")}return{repaired:n,suggested:i}}El();import{existsSync as w6e,readFileSync as x6e}from"node:fs";import{join as $6e}from"node:path";function k6e(t,e){let r=$6e(t,e);if(!w6e(r))return[];let n=[];for(let i of x6e(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 Ure(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=>k6e(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 qre(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();un();Pi();un();El();var SM=["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"],E6e=[...SM,"att"];function A6e(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 Qx(n).filter(s=>i.includes(s.acId)).length>0?"\u2717":"\u2713"}return"-"}function O6e(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 f0(t,e="."){let r=ds(e),n=t.features.map(i=>({featureId:i.id,title:i.title||i.id,status:i.status,cells:[...SM.map(o=>A6e(i,o,e)),O6e(i,r,e)]}));return{columns:E6e,rows:n}}function Hre(t,e=".",r={}){let n=r.internal??!1,i=f0(t,e),o=[...SM.map(c=>n?c.replace("stage_",""):T6e(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 T6e(t){return Ra(t).slice(0,3)}async function sXe(t){let[{buildServer:e},{StdioServerTransport:r},{setHostMcpServer:n}]=await Promise.all([Promise.resolve().then(()=>(nfe(),rfe)),Promise.resolve().then(()=>(cfe(),afe)),Promise.resolve().then(()=>(lm(),_Q))]),i=e({cwd:t.cwd,onboarding:{renderDraft:s=>Wte(s),prepareInit:({cwd:s,mode:a,intent:c})=>Zte(s,a,c),initialize:jj,prepareClarify:(s,{cwd:a})=>Vte(a,s),clarify:zj,resolveReview:(s,{cwd:a})=>qte(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 aXe(t,e){let r=t&&t.length>0?t.join(" ").trim():void 0,n=await jj({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: `);for(let[o,s]of n.clarifyingQuestions.entries())H.stdout.write(` ${o+1}. ${s} @@ -952,28 +952,28 @@ ${_} - "derived:${m}"`),i.push({shard:a,ref:`derived:${m}`}),d=!0}d&&h6e(c,l,"u `),H.stdout.write(` e.g. clad init payment SaaS for B2B `),H.stdout.write(` The existing seeds divert to .cladding/scan/*.proposal. -`));H.exit(0)}async function nXe(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(()=>(Cfe(),Pfe)),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=>yR(l,s)),c=`${MG(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 iXe(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(".");nu(".",r),rc("."),IY(".");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=zre(".");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=u0(".");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 oXe(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 sXe(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.exit(0)}async function cXe(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(()=>(Cfe(),Pfe)),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=>_R(l,s)),c=`${MG(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 lXe(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(".");nu(".",r),rc("."),IY(".");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=zre(".");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=d0(".");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 uXe(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 dXe(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 aXe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await OC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function cXe(){L("note","update","reconciling the current project after the engine upgrade");let t=await H7(".",{wireHosts:async()=>(await OC({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(` +`),H.exit(0)}async function fXe(t){let e=t.host?t.host==="all"?["claude","codex","gemini","antigravity","cursor"].slice():[t.host]:void 0,r=await RC({force:t.force,quiet:t.quiet,projectRoot:t.project,hosts:e});H.exit(r.errors.length>0?1:0)}async function pXe(){L("note","update","reconciling the current project after the engine upgrade");let t=await H7(".",{wireHosts:async()=>(await RC({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): -`),FA({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 lXe={"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 FA(t){let e=t.tier??"all",r=t.silent===!0,n=lXe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",oM],["stage_1.5",ac],["stage_1.6",nm],["stage_2.1",()=>gM({...i,strict:t.strict})],["stage_2.2",()=>sM(i)],["stage_2.3",BC],["stage_2.4",uM],["stage_3.1",dM],["stage_3.2",cM],["stage_3.3",yM],["stage_4.1",eM],["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("."),pre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=SX(p);mr(h)&&(c=!0,a=Math.max(a,wX(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)&&yXe(p))}}finally{rb(),hre()}if(t.strict)try{let d=q();for(let f of dre(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{aZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:oZ(RS)})&&(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:IS(u),stopFingerprint:xX(u)}),{worst:a,anyFailed:c,stages:u}}function uXe(t){try{let e=q(),r=bl(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 dXe(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 fXe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=OS(e,o=>{try{return Dfe(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 pXe(t={}){try{if(t.sessions){Yte(t);return}if(t.trend!==void 0&&t.trend!==!1){Xte(t);return}let e=q(),n=rG(e,o=>{try{return Dfe(o,"utf8")}catch{return null}},"."),i=iG(".",n);if(t.json)H.stdout.write(`${JSON.stringify(n,null,2)} +`),LA({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 mXe={"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 LA(t){let e=t.tier??"all",r=t.silent===!0,n=mXe[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",()=>lh(i)],["stage_1.2",()=>ch(i)],["stage_1.3",()=>ci({...i,strict:t.strict})],["stage_1.4",oM],["stage_1.5",ac],["stage_1.6",nm],["stage_2.1",()=>gM({...i,strict:t.strict})],["stage_2.2",()=>sM(i)],["stage_2.3",GC],["stage_2.4",uM],["stage_3.1",dM],["stage_3.2",cM],["stage_3.3",yM],["stage_4.1",eM],["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("."),pre(".");try{for(let[d,f]of s){let p=f({}),m=t.internal?d:Ra(d),h=SX(p);mr(h)&&(c=!0,a=Math.max(a,wX(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)&&wXe(p))}}finally{rb(),hre()}if(t.strict)try{let d=q();for(let f of dre(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{aZ(".",q(),{cladding:fn()??"unknown",blocking:"strict",detectorsSha256:oZ(IS)})&&(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:PS(u),stopFingerprint:xX(u)}),{worst:a,anyFailed:c,stages:u}}function hXe(t){try{let e=q(),r=bl(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 gXe(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 yXe(t={}){try{let e=q(),r=t.ambiguity!==void 0?Number(t.ambiguity):void 0,i=RS(e,o=>{try{return Dfe(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 _Xe(t={}){try{if(t.sessions){Yte(t);return}if(t.trend!==void 0&&t.trend!==!1){Xte(t);return}let e=q(),n=rG(e,o=>{try{return Dfe(o,"utf8")}catch{return null}},"."),i=iG(".",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)}`,` ${vl}`];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 mXe(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=FA({...t,focusModules:e});if(!t.json){let n=d7(".");n&&H.stdout.write(`\u2139 ${n} -`)}H.exitCode=r.worst}function hXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=n7(".",t,{checkStages:FA,onIndex:rc,gitOpInProgress:LO,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 gXe(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}') +`),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 bXe(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=LA({...t,focusModules:e});if(!t.json){let n=d7(".");n&&H.stdout.write(`\u2139 ${n} +`)}H.exitCode=r.worst}function vXe(t){let e;try{e={policy:q(".").project.independence_policy??"label",evidence:pr(".")}}catch{e=void 0}let r=n7(".",t,{checkStages:LA,onIndex:rc,gitOpInProgress:zT,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 SXe(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=jY(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=Ure(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(`${qre(i)} -`),H.exit(0)}function yXe(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=P4(Ia(i.detector,i.message),140),s=i.path?` \u2014 ${i.path}`:"";if(H.stdout.write(` ${o}${s} [${i.detector}] +`),H.exit(0)}function wXe(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=P4(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(` `).map(l=>l.trim()).filter(l=>l.length>0);for(let l of c.slice(0,4))H.stdout.write(` ${P4(l,160)} `);c.length>4&&H.stdout.write(` \u2026 and ${c.length-4} more line(s) \u2014 see \`clad check --json\` @@ -982,6 +982,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(` ${P4(r,160)} `);e.length>5&&H.stdout.write(` \u2026 and ${e.length-5} more line(s) \u2014 see \`clad check --json\` -`)}}function P4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function _Xe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(d0(e,"."),null,2)} +`)}}function P4(t,e){return t.length<=e?t:`${t.slice(0,e-1)}\u2026`}function xXe(t){let e=q();if(t.json){H.stdout.write(`${JSON.stringify(f0(e,"."),null,2)} `),H.exitCode=0;return}H.stdout.write(`${Hre(e,".",{internal:t.internal})} -`),H.exit(0)}function bXe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function vXe(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=d0(i,e),s={gitHead:xa(e),version:fn(),generatedAt:t.now??new Date().toISOString()},a=xl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Sl(u),auditMarkdown:wl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=JG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{eXe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${bXe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function SXe(t){let e=nT(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function wXe(){let t=new Z4;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(rXe),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(nXe),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(iXe),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(aXe),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(cXe),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(mXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(oXe),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(hXe),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)=>gXe(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(sXe),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(_Xe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(uXe),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)=>dXe(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=>F7(r,{checkStages:FA})),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=>fXe(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=>pXe(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=>cre(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>lre()),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=>{ure(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=>jG(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=>vX(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=>vXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(SXe),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(I7),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(tXe),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){QX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}HX(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(Gte),t}var xXe=!!globalThis.__CLADDING_BUNDLED,$Xe=xXe||import.meta.url===`file://${H.argv[1]}`;$Xe&&wXe().parse();export{lXe as TIER_STAGES,wXe as createProgram,vXe as runBundleCommand,mXe as runCheckCommand,FA as runCheckStages,oXe as runCheckpointCommand,uXe as runContextCommand,hXe as runDoneCommand,dXe as runImpactCommand,fXe as runInferDepsCommand,rXe as runInitCommand,pXe as runMeasureCommand,gXe as runOracleCommand,sXe as runRollbackCommand,SXe as runRouteCommand,nXe as runRunCommand,tXe as runServeCommand,aXe as runSetupCommand,_Xe as runStatusCommand,iXe as runSyncCommand,cXe as runUpdateCommand}; +`),H.exit(0)}function $Xe(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(2)} MB`}function kXe(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=f0(i,e),s={gitHead:xa(e),version:fn(),generatedAt:t.now??new Date().toISOString()},a=xl(i),c;try{let l=t.since??is(e),u=os(e,l);c={kind:"present",sinceRef:l,changelogMarkdown:Sl(u),auditMarkdown:wl(u,i,e)}}catch(l){c={kind:"omitted",reason:l.message}}n=JG({spec:i,panel:o,provenance:s,catalogMarkdown:a,changes:c})}catch(i){L("fail","bundle",i.message),H.exit(1);return}try{oXe(r,n,"utf8")}catch(i){L("fail","bundle",`could not write ${r}: ${i.message}`),H.exit(1);return}L("pass","bundle",`${r} \xB7 ${$Xe(Buffer.byteLength(n,"utf8"))}`),H.exit(0)}function EXe(t){let e=iO(t);L("note",`route \u2192 ${e}`,t),H.exit(e==="unknown"?1:0)}function AXe(){let t=new Z4;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(aXe),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(cXe),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(lXe),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(fXe),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(pXe),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(bXe),t.command("checkpoint ").description("Record a checkpoint event pinning git HEAD + spec digest for the feature (iron-law \xA72.5)").action(uXe),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(vXe),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)=>SXe(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(dXe),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(xXe),t.command("context ").description("Print the context slice for one feature \u2014 id (F-\u2026), slug, or module path (F-d2c806)").action(hXe),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)=>gXe(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=>F7(r,{checkStages:LA})),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=>yXe(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=>_Xe(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=>cre(r)),e.command("stats").description("Report node/edge counts by kind and the top hubs by degree").action(()=>lre()),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=>{ure(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=>jG(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=>vX(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=>kXe(r)),t.command("route ").description("Classify a natural-language prompt to a verb").action(EXe),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(I7),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(sXe),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){QX({cwd:r.cwd,yes:r.yes,matrixOnly:r.matrixOnly});return}HX(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(Gte),t}var OXe=!!globalThis.__CLADDING_BUNDLED,TXe=OXe||import.meta.url===`file://${H.argv[1]}`;TXe&&AXe().parse();export{mXe as TIER_STAGES,AXe as createProgram,kXe as runBundleCommand,bXe as runCheckCommand,LA as runCheckStages,uXe as runCheckpointCommand,hXe as runContextCommand,vXe as runDoneCommand,gXe as runImpactCommand,yXe as runInferDepsCommand,aXe as runInitCommand,_Xe as runMeasureCommand,SXe as runOracleCommand,dXe as runRollbackCommand,EXe as runRouteCommand,cXe as runRunCommand,sXe as runServeCommand,fXe as runSetupCommand,xXe as runStatusCommand,lXe as runSyncCommand,pXe as runUpdateCommand}; diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 95ad8df0..0c0c4150 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -26,12 +26,12 @@ attested_modules: CHANGELOG.md: b15c6185d8326b9b CLAUDE.md: 9f2fa4edd5c6df80 GOVERNANCE.md: 21cc28eaaf637a20 - README.html: f6403bfe696dad0a - README.ja.md: c356a1bb47f09704 - README.ko.html: c8ab0b905cf72c6e - README.ko.md: 166b7013ec751549 - README.md: 4b2a0103093f338b - README.zh.md: 4de9ba6f9fb14de1 + README.html: 736f4c0126990f5b + README.ja.md: 82b53a627e2d1b1f + README.ko.html: efbfce7cab897fb6 + README.ko.md: 3f31659ae168dcb1 + README.md: 4b06c324d8168a7c + README.zh.md: c7ac2cfce5153064 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 conformance/fixtures.yaml: 4b1b94dae1cd20b0 @@ -72,7 +72,7 @@ attested_modules: docs/img/ko/relationship.svg: 9ec8fb2254978f37 docs/img/zh/independence.svg: 073303a42e601f7c docs/multi-provider-roadmap.md: 1e5cf27ea1b18d06 - docs/refinement-backlog.md: 918426e582bf2739 + docs/refinement-backlog.md: 51469bde4d9dddfd docs/setup.md: a5c062651d267983 docs/spec-ids-multi-dev.md: ee52e431278e1c1a docs/ssot-model.md: 66b9439e2f71ac4b @@ -260,7 +260,7 @@ attested_modules: src/spec/reverse-index.ts: fa54d7203a02799a src/spec/schema.json: 848951cd01d7f82f src/spec/test-ref-repair.ts: 5ce823b479aaaca3 - src/spec/types.ts: 5799bc9fc1e00553 + src/spec/types.ts: e8a195929f114491 src/spec/validate.ts: db88ca6512ab363a src/stages: a4d0f0eb87fed960 src/stages/README.md: c79d2bced8c8b8d8 @@ -311,7 +311,7 @@ attested_modules: src/stages/detectors/stale-tests.ts: caf59404d1282201 src/stages/detectors/status-drift.ts: 9cc5cf3f9b62ea00 src/stages/detectors/tech-stack-mismatch.ts: 4da504acb67aaa86 - src/stages/detectors/unmapped-artifact.ts: 6696179e5958f37c + src/stages/detectors/unmapped-artifact.ts: b46ec1bd013dcce5 src/stages/detectors/untested-ac.ts: 90725ef1fc9245d8 src/stages/detectors/unverified-ac.ts: 6887c4d699afaad5 src/stages/detectors/with-spec.ts: dcf3205e8d563574 @@ -441,7 +441,7 @@ attested_modules: tests/stages/type.test.ts: b57cf7455cae3b32 tests/stages/uat.test.ts: 29c5bf3e7f3abc35 tests/stages/unit.test.ts: 97781210eb81bb25 - tests/stages/unmapped-artifact.test.ts: c16219779f6164bb + tests/stages/unmapped-artifact.test.ts: d29ba5a32abadcc9 tests/stages/util.test.ts: a162cbe069c85f41 tests/stages/visual.test.ts: dd819e7d25586b92 tests/ui/panel.test.ts: ad9ea207f34b1c51 diff --git a/spec/features/ac-hash-ids-a04cd9.yaml b/spec/features/ac-hash-ids-a04cd9.yaml index 2856347b..03ab4097 100644 --- a/spec/features/ac-hash-ids-a04cd9.yaml +++ b/spec/features/ac-hash-ids-a04cd9.yaml @@ -25,7 +25,12 @@ acceptance_criteria: test_refs: [tests/spec/new.test.ts] - id: AC-003 ears: ubiquitous - action: 'mark architecture layer.modules as advisory and stop the LLM onboarding prompts from emitting it, since ARCHITECTURE_FROM_SPEC does not consume it' - response: 'the dead glob field is removed from the two onboarding prompts and the type documents it as advisory-not-enforced; full consumption is a tracked follow-up rather than a hidden dead link' - text: The system shall not generate the unconsumed architecture layer.modules field and shall document it as advisory, so the schema does not invite a link the detector cannot follow. + action: 'stop the LLM onboarding prompts from emitting architecture layer.modules, and document exactly who consumes it' + response: 'the glob field is removed from the two onboarding prompts; the tracked follow-up landed in F-87bb7ed3, which made UNMAPPED_ARTIFACT consume the declared globs as that layer''s scan universe, while ARCHITECTURE_FROM_SPEC still does not read it — the type comment names both facts' + text: The system shall not generate the architecture layer.modules field from onboarding prompts and shall document its consumers precisely, so the schema neither invites a dead link nor hides a live one. + notes: | + ## Why (amended 2026-08-26) + Originally the field was advisory because no detector consumed it. + F-87bb7ed3 (AC-96ff696f) made UNMAPPED_ARTIFACT consume declared layer + globs; this criterion's prose is updated so the two entries agree. test_refs: [tests/spec/new.test.ts] diff --git a/spec/features/self-describing-scan-universe-87bb7ed3.yaml b/spec/features/self-describing-scan-universe-87bb7ed3.yaml index 5b3ef8a9..a7936b8f 100644 --- a/spec/features/self-describing-scan-universe-87bb7ed3.yaml +++ b/spec/features/self-describing-scan-universe-87bb7ed3.yaml @@ -65,6 +65,27 @@ acceptance_criteria: dogfood repo (277 features): the evidence universe produces zero new unclaimed findings — the discipline is in the spec, not the label. test_refs: ["tests/stages/unmapped-universe-evidence.test.ts"] + - id: AC-96ff696f + ears: event + condition: "when a declared architecture layer carries its own modules globs" + action: "use those globs, expanded by the evidenced extensions, as that layer's universe patterns instead of name-segment inference" + response: "a layer whose name is not a literal directory segment still gets scanned exactly where its declaration points — the declared architecture is the SSoT the detector was ignoring" + text: "When a layer declares modules globs, the system shall derive that layer's scan patterns from the declared globs and the evidenced extensions, bypassing name-based root inference for it." + notes: | + ## Why + External E2E (D1): two specs identical except the layer name — 'core' + (matches a path segment) found 21 unclaimed files, 'native' (no matching + segment) found 0, silently, despite both declaring + modules: ["core/src/main/cpp/**"]. The schema already supports per-layer + globs; the detector ignored a declared surface. + test_refs: ["tests/stages/unmapped-artifact.test.ts", "tests/stages/unmapped-universe-evidence.test.ts"] + - id: AC-e20dbafe + ears: unwanted + condition: "if the active full scan resolves to an empty universe or matches zero files" + action: "emit one info finding naming the layers and roots it looked for" + response: "an empty module-honesty scan is visible instead of reading as a clean pass — the no-silent-caps rule applied to this detector" + text: "If the full scan matches nothing, the system shall emit one info finding instead of silence." + test_refs: ["tests/stages/unmapped-artifact.test.ts", "tests/stages/unmapped-universe-evidence.test.ts"] design_impact: classification: none rationale: "Rewires one detector's universe derivation from a language table to spec-and-tree evidence; scale gate, severity, and finding shape unchanged." diff --git a/src/spec/types.ts b/src/spec/types.ts index 1da5770c..ef88df4c 100644 --- a/src/spec/types.ts +++ b/src/spec/types.ts @@ -127,16 +127,19 @@ export interface Scenario { export interface ArchitectureLayerObject { readonly name?: string; /** - * ADVISORY (not yet enforced). Glob(s) naming the files in this layer. - * `ARCHITECTURE_FROM_SPEC` currently derives a layer's directory from - * `name` (`src//`) and does NOT consume these globs — so a declared - * `modules` is documentation for humans/reviewers, not a live binding. The - * deterministic scan renderer (`renderArchitectureYaml`, src/cli/scan/llm.ts) - * still emits it on `clad init --scan`, so it is live-but-advisory in real - * specs. Marking it advisory (rather than wiring the detector to consume the - * globs) is the deliberate J5b decision recorded in - * spec/features/ac-hash-ids-a04cd9.yaml (AC-003); full consumption stays a - * tracked follow-up there, not a hidden dead link. + * Glob(s) naming the files in this layer, as the deterministic scan + * renderer emits them (`renderArchitectureYaml`, src/cli/scan/llm.ts) on + * `clad init --scan`. + * + * PARTIALLY CONSUMED, by exactly one detector: + * · `UNMAPPED_ARTIFACT` (F-87bb7ed3, AC-96ff696f) takes these globs as + * the layer's scan universe, so a layer whose `name` is not a literal + * path segment is still scanned where its declaration points. + * · `ARCHITECTURE_FROM_SPEC` still derives a layer's directory from + * `name` (`//`) and does NOT read these globs — the + * deliberate J5b decision recorded in + * spec/features/ac-hash-ids-a04cd9.yaml (AC-003). Its forbidden-import + * and empty-layer checks therefore remain name-based. */ readonly modules?: readonly string[]; readonly forbidden_imports?: readonly string[]; diff --git a/src/stages/detectors/unmapped-artifact.ts b/src/stages/detectors/unmapped-artifact.ts index 3e2d9413..225c9679 100644 --- a/src/stages/detectors/unmapped-artifact.ts +++ b/src/stages/detectors/unmapped-artifact.ts @@ -6,14 +6,24 @@ // that no feature in spec.yaml claims via `features[].modules`. // // The scan universe is EVIDENCE, never a language label (F-87bb7ed3). -// Two sources compose, each covering the other's blind spot: +// Three sources compose, each covering the others' blind spots: // -// 1. Observation — every vocabulary-known extension that actually +// 1. Declared layer globs — a layer written in object form with its +// own `modules: ["core/src/main/cpp/**"]` has already said where it +// lives, so that layer's patterns are its globs crossed with the +// evidenced extensions and name-segment inference is not used for +// it at all. The defect this repairs (external E2E, D1): two specs +// identical except the layer name — `core` (a real path segment) +// reported 21 unclaimed files, `native` (no matching segment) +// reported 0, silently, though both declared the same glob. The +// declared architecture is the SSoT; the detector was ignoring a +// surface the schema already carried. +// 2. Observation — every vocabulary-known extension that actually // occurs in the tree (core/language-evidence). This covers the // lazy spec: an unclaimed `.cpp` file stays visible even when the // spec claims only `.java` ones, which is the exact case this // detector exists for. -// 2. Claimed modules — the extension and the root of every module a +// 3. Claimed modules — the extension and the root of every module a // feature claims under a declared layer. This teaches languages // the vocabulary has never heard of: a claimed `.zig` file enters // the universe with no table to grow, and a claimed @@ -27,6 +37,14 @@ // the module→feature honesty check is for. A label can be wrong; what // is on disk and what the spec claims cannot be mislabelled the same way. // +// A universe can still come out empty: a layer name matching no directory, +// a declared glob pointing at a moved tree, a tree of extensions nothing +// knows or claims. Zero scanned files reads exactly like a clean bill of +// health, so it is never silent — an ACTIVE full scan that matches nothing +// emits ONE `info` finding naming the layers and the roots it looked under +// (AC-e20dbafe). Below the scale gate, and whenever files were scanned, +// the diagnostic stays quiet. +// // Pure spec ↔ filesystem comparison, no OSS for the *logic* — though // glob scanning is delegated to `tinyglobby` because Node's stdlib // doesn't ship a globber. @@ -38,7 +56,7 @@ import {extname} from 'node:path'; import {globSync} from 'tinyglobby'; import {observedKnownExtensions} from '../../core/language-evidence.js'; -import type {Spec} from '../../spec/types.js'; +import type {Architecture, ArchitectureLayerObject, Spec} from '../../spec/types.js'; import type {CommandStageOptions, DriftDetector, DriftFinding} from '../types.js'; import {normalizeArchitecture} from './architecture-from-spec.js'; import {withSpec} from './with-spec.js'; @@ -75,29 +93,111 @@ const DEFAULT_ROOT = 'src'; */ const MIN_ROOT_SHARE = 0.25; +/** + * Reads the `modules` globs each declared layer carries, keyed by layer name. + * + * `normalizeArchitecture` stays the SSoT for WHICH layers exist — it is + * shared with ARCHITECTURE_FROM_SPEC and answers with names only. The globs + * are read here, locally, because this detector is the one that consumes + * them; layers declared in the canonical tier form (`[[cli, serve]]`) carry + * no globs and are absent from the map. + * + * @param arch - `spec.architecture`, in either declared shape. + * @returns Layer name → its non-empty declared globs; layers without globs + * are omitted, so `has(layer)` answers "declares its own location". + */ +function declaredGlobs(arch: Architecture): ReadonlyMap { + const byLayer = new Map(); + for (const tier of arch.layers ?? []) { + if (Array.isArray(tier)) continue; // canonical tier form: names, no globs + const layer = tier as ArchitectureLayerObject; + if (typeof layer.name !== 'string' || layer.name.length === 0) continue; + const globs = (layer.modules ?? []).filter( + (glob): glob is string => typeof glob === 'string' && glob.length > 0, + ); + if (globs.length === 0) continue; + byLayer.set(layer.name, [...(byLayer.get(layer.name) ?? []), ...globs]); + } + return byLayer; +} + +/** + * The literal directory prefix of a declared glob — everything before its + * first wildcard, slash-terminated: `core/src/main/cpp/**` and a + * wildcard-free `core/src/main/cpp` both yield `core/src/main/cpp/`. + * + * Deliberately not a glob matcher. The only question asked of it is "does + * this claimed module live where the layer says the layer lives", and a + * prefix answers that for the directory globs `clad init --scan` writes + * without pulling in a matching engine. + */ +function globPrefix(glob: string): string { + const star = glob.indexOf('*'); + const literal = star < 0 ? glob : glob.slice(0, star); + return literal.length === 0 || literal.endsWith('/') ? literal : `${literal}/`; +} + +/** + * Expands one declared glob into the scan pattern for `ext`. + * + * A glob that already ends in a recursive wildcard keeps that recursion and + * only gains the file part; any other form gains the recursion too — so a + * bare directory glob (`core/src/main/cpp`) and its wildcard spelling scan + * the same tree. + * + * Both branches treat the declared glob as a DIRECTORY, which is the shape + * the scan renderer writes. A hand-written glob that already names files + * (`src/core/*.ts`) therefore expands to a pattern matching nothing; when + * that leaves the whole scan empty, the finding below reports it rather + * than passing silently. + */ +function expandGlob(glob: string, ext: string): string { + return glob.endsWith('**') ? `${glob}/*${ext}` : `${glob}/**/*${ext}`; +} + /** What the spec's own module claims teach about the scan universe. */ interface ClaimedEvidence { /** Path prefixes that precede a declared layer name, dominance-filtered. */ readonly roots: readonly string[]; - /** Extensions claimed under one of those roots, with leading dot. */ + /** Extensions claimed under one of those roots or under a declared glob. */ readonly extensions: readonly string[]; } /** * Reads roots and extensions out of `features[].modules`. * - * Only a module that sits under a declared layer teaches anything: a - * root-level `CHANGELOG.md` claim contributes neither a root nor an - * extension, so documentation claims cannot widen the source universe. + * A module teaches only when it is layer-claimed, and there are two ways to + * be: it sits under an inferred root + a declared layer name (the root it + * teaches must then survive the dominance filter), or its path starts with + * the literal prefix of a glob some layer declares. Anything else teaches + * nothing — a root-level `CHANGELOG.md` claim cannot widen the source + * universe. + * + * @param spec - The loaded spec; `features[].modules` is the only field read. + * @param layers - Declared layer names, for the name-segment match. + * @param globPrefixes - Literal prefixes of every declared layer glob. */ -function claimedEvidence(spec: Spec, layers: ReadonlySet): ClaimedEvidence { +function claimedEvidence( + spec: Spec, + layers: ReadonlySet, + globPrefixes: readonly string[], +): ClaimedEvidence { const claimsByRoot = new Map(); const extensionsByRoot = new Map>(); + const underDeclaredGlob = new Set(); let total = 0; for (const feature of spec.features ?? []) { for (const modulePath of feature.modules ?? []) { const segments = modulePath.split('/'); + const ext = extname(segments[segments.length - 1]); + + // A layer's own glob needs no root inference — the declaration already + // located the layer, so a claim under it only teaches its extension. + if (ext !== '' && globPrefixes.some((prefix) => modulePath.startsWith(prefix))) { + underDeclaredGlob.add(ext); + } + // The last segment is the file itself — a file named like a layer // is not a directory the layer lives in. const layerAt = segments.findIndex( @@ -109,7 +209,6 @@ function claimedEvidence(spec: Spec, layers: ReadonlySet): ClaimedEviden claimsByRoot.set(root, (claimsByRoot.get(root) ?? 0) + 1); total += 1; - const ext = extname(segments[segments.length - 1]); if (ext === '') continue; // a claimed directory teaches its root, not an extension const known = extensionsByRoot.get(root) ?? new Set(); known.add(ext); @@ -118,7 +217,7 @@ function claimedEvidence(spec: Spec, layers: ReadonlySet): ClaimedEviden } const roots: string[] = []; - const extensions = new Set(); + const extensions = new Set(underDeclaredGlob); for (const [root, claims] of claimsByRoot) { if (claims / total < MIN_ROOT_SHARE) continue; roots.push(root); @@ -127,39 +226,119 @@ function claimedEvidence(spec: Spec, layers: ReadonlySet): ClaimedEviden return {roots, extensions: [...extensions]}; } +/** The resolved scan universe plus what it took to build it. */ +interface ScanUniverse { + /** Globs to scan; the legacy narrow pair when the scale gate is not met. */ + readonly patterns: readonly string[]; + /** True only when the evidence universe is active (≥8 features + layers). */ + readonly fullScan: boolean; + /** Declared layer names, in declaration order. */ + readonly layers: readonly string[]; + /** Where the scan looked: inferred roots, and each declared layer glob. */ + readonly roots: readonly string[]; + /** True when every declared layer brought its own globs. */ + readonly everyLayerDeclaresGlobs: boolean; +} + +const LEGACY_UNIVERSE: ScanUniverse = { + patterns: LEGACY_SCAN_PATTERNS, + fullScan: false, + layers: [], + roots: [], + everyLayerDeclaresGlobs: false, +}; + /** - * Builds the glob set the detector scans: one pattern per scan root, - * declared layer, and evidenced extension. + * Resolves the glob set the detector scans, plus the layers and roots that + * produced it (the empty-universe diagnostic reports them). * - * @param spec - The loaded spec; read for features, architecture, and - * module claims — never for `project.language`. - * @param cwd - Project root, walked once for the observed extensions. - * @returns Sorted, deduplicated glob patterns; the legacy narrow pair - * when the full-scan scale gate is not met. + * Per layer, one of two derivations runs — never both: + * · the layer declared `modules` globs → its patterns are those globs + * crossed with the evidenced extensions (AC-96ff696f); + * · it did not → one pattern per inferred scan root, the layer NAME as a + * path segment, and each evidenced extension (AC-9a6f02d3). + * + * The extension set is shared by both: observed known extensions united + * with the layer-claimed ones. */ -export function scanPatterns(spec: Spec, cwd: string): readonly string[] { +function scanUniverse(spec: Spec, cwd: string): ScanUniverse { // Scale-gated (F-aee61f): a fresh adoption legitimately has scan-derived // architecture layers but features accumulating on demand — instantly // flagging every not-yet-claimed file would wall off day-1 adoption (the // false-RED class the 0.6 design review warned about). Once the project // is grown (≥8 features), an unclaimed file in a declared layer is drift. - if ((spec.features ?? []).length < MIN_FEATURES_FOR_FULL_SCAN) return LEGACY_SCAN_PATTERNS; - const {layers} = normalizeArchitecture(spec.architecture ?? {}); - if (layers.size === 0) return LEGACY_SCAN_PATTERNS; + if ((spec.features ?? []).length < MIN_FEATURES_FOR_FULL_SCAN) return LEGACY_UNIVERSE; + const architecture = spec.architecture ?? {}; + const {layers} = normalizeArchitecture(architecture); + if (layers.size === 0) return LEGACY_UNIVERSE; - const claimed = claimedEvidence(spec, layers); + const globsByLayer = declaredGlobs(architecture); + const globPrefixes = [...globsByLayer.values()].flat().map(globPrefix); + const claimed = claimedEvidence(spec, layers, globPrefixes); const roots = claimed.roots.length > 0 ? claimed.roots : [DEFAULT_ROOT]; const extensions = new Set([...observedKnownExtensions(cwd), ...claimed.extensions]); const patterns = new Set(); - for (const root of roots) { - // An empty root means the layers sit at the repository root itself. - const prefix = root === '' ? '' : `${root}/`; - for (const layer of layers) { + const searched = new Set(); + for (const layer of layers) { + const globs = globsByLayer.get(layer); + if (globs !== undefined) { + for (const glob of globs) { + searched.add(glob); + for (const ext of extensions) patterns.add(expandGlob(glob, ext)); + } + continue; + } + for (const root of roots) { + // An empty root means the layers sit at the repository root itself. + const prefix = root === '' ? '' : `${root}/`; + searched.add(root === '' ? '.' : root); for (const ext of extensions) patterns.add(`${prefix}${layer}/**/*${ext}`); } } - return [...patterns].sort(); + + return { + patterns: [...patterns].sort(), + fullScan: true, + layers: [...layers], + roots: [...searched], + everyLayerDeclaresGlobs: globsByLayer.size === layers.size, + }; +} + +/** + * Builds the glob set the detector scans: one pattern per declared layer + * glob, or per scan root and layer name when the layer declares none. + * + * @param spec - The loaded spec; read for features, architecture, and + * module claims — never for `project.language`. + * @param cwd - Project root, walked once for the observed extensions. + * @returns Sorted, deduplicated glob patterns; the legacy narrow pair + * when the full-scan scale gate is not met. + */ +export function scanPatterns(spec: Spec, cwd: string): readonly string[] { + return scanUniverse(spec, cwd).patterns; +} + +/** + * The single `info` finding for an active full scan that matched nothing. + * + * An empty universe and a fully-claimed tree produce the same silence, and + * only one of them is good news — so the scan says where it looked and what + * would move it. Info severity: it never blocks a gate, it just refuses to + * let a scan of nothing read as a pass (AC-e20dbafe). + */ +function emptyUniverseFinding(universe: ScanUniverse): DriftFinding { + const advice = universe.everyLayerDeclaresGlobs + ? 'check the declared layer modules globs against the tree' + : 'declare layer modules globs or align layer names with directories'; + return { + detector: NAME, + severity: 'info', + message: + `full scan matched no files — layers {${universe.layers.join(', ')}} ` + + `under roots {${universe.roots.join(', ')}}; ${advice}`, + }; } /** @@ -168,8 +347,8 @@ export function scanPatterns(spec: Spec, cwd: string): readonly string[] { * Returns one `error` finding per unclaimed file. When spec.yaml is * absent or unparseable, returns a single `info` finding (opt-in: * spec-less projects keep green CI). The detector intentionally does - * not walk the entire repo — only the roots and layers the spec and the - * tree together evidence as source. + * not walk the entire repo — only the roots, globs, and layers the spec + * and the tree together evidence as source. * * @see iron-law.md stage_1.3 — detector contract. * @see ironclad-design/08-drift-detectors.md — UNMAPPED_ARTIFACT (#1). @@ -185,11 +364,16 @@ function detect(spec: Spec, cwd: string): readonly DriftFinding[] { for (const modulePath of feature.modules ?? []) claimed.add(modulePath); } - const patterns = scanPatterns(spec, cwd); + const universe = scanUniverse(spec, cwd); // No evidenced extension means no source universe. Guarded rather than // handed to the globber, so "nothing to scan" can never be read as // "scan everything". - const files = patterns.length === 0 ? [] : globSync([...patterns], {cwd, dot: false}); + const files = + universe.patterns.length === 0 ? [] : globSync([...universe.patterns], {cwd, dot: false}); + // Empty patterns and matching patterns that find nothing are the same + // outcome — a scan that inspected no file — and both are reported. + if (universe.fullScan && files.length === 0) return [emptyUniverseFinding(universe)]; + const findings: DriftFinding[] = []; for (const file of files) { if (claimed.has(file)) continue; diff --git a/tests/stages/unmapped-artifact.test.ts b/tests/stages/unmapped-artifact.test.ts index 719d5173..1b315782 100644 --- a/tests/stages/unmapped-artifact.test.ts +++ b/tests/stages/unmapped-artifact.test.ts @@ -14,6 +14,13 @@ // spec honest, claimed modules teach roots and unknown languages. // Only modules under a declared layer teach, so a root-level docs // claim cannot widen the source universe. +// - A layer that declares its own `modules` globs is scanned **there**, +// not under `//` — the layer name is then free to be +// a label ('native') rather than a directory. Measured defect: two +// specs identical but for the layer name found 21 files vs 0. +// - An active full scan that matches **zero files** says so with one +// `info` finding, because an empty universe and a fully-claimed tree +// otherwise look identical from the outside. // - It is status-blind: an archived feature still claims its modules, // because deleting the archived feature's source is a separate // workflow that STATUS_DRIFT / STALE_SPECIFICATION owns. @@ -313,21 +320,106 @@ describe('scanPatterns', () => { expect(universe('brainfuck')).toEqual(expected); // nor an unknown one expect(universe(undefined)).toEqual(expected); // nor a missing one }); + + test('AC-96ff696f — a declared layer glob replaces name inference for that layer', () => { + write(dir, 'core/src/main/cpp/rasp.cpp'); + const spec = { + project: {name: 'x', language: 'cpp'}, + features: EIGHT_FEATURES, + architecture: {layers: [{name: 'native', modules: ['core/src/main/cpp/**']}]}, + } as never; + // `native` names no directory anywhere: name inference would glob + // `src/native/**` and match nothing, which is defect D1 exactly. + expect(scanPatterns(spec, dir)).toEqual(['core/src/main/cpp/**/*.cpp']); + }); + + test('AC-96ff696f — a declared glob without a trailing wildcard still recurses', () => { + write(dir, 'core/src/main/cpp/rasp.cpp'); + const spec = { + project: {name: 'x', language: 'cpp'}, + features: EIGHT_FEATURES, + architecture: {layers: [{name: 'native', modules: ['core/src/main/cpp']}]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['core/src/main/cpp/**/*.cpp']); + }); + + test('AC-96ff696f — a glob layer and a bare layer each derive their own patterns', () => { + write(dir, 'core/src/main/cpp/rasp.cpp'); + write(dir, 'src/router/route.ts'); + const spec = { + project: {name: 'x', language: 'cpp'}, + features: EIGHT_FEATURES, + architecture: {layers: [['router'], {name: 'native', modules: ['core/src/main/cpp/**']}]}, + } as never; + // One evidenced extension set, two derivations: the glob for `native`, + // the inferred root + name for `router`. + expect(scanPatterns(spec, dir)).toEqual([ + 'core/src/main/cpp/**/*.cpp', + 'core/src/main/cpp/**/*.ts', + 'src/router/**/*.cpp', + 'src/router/**/*.ts', + ]); + }); + + test('AC-96ff696f — a claim under a declared glob teaches its extension', () => { + write(dir, 'core/src/main/zig/a.zig'); // unknown to the vocabulary → observation ignores it + const spec = { + project: {name: 'x', language: 'zig'}, + features: claiming('core/src/main/zig/a.zig'), + architecture: {layers: [{name: 'native', modules: ['core/src/main/zig/**']}]}, + } as never; + // The claim sits under no layer-named segment, so only the glob prefix + // can make it count as layer-claimed. + expect(scanPatterns(spec, dir)).toEqual(['core/src/main/zig/**/*.zig']); + }); + + test('AC-96ff696f — an object layer without globs keeps name-based inference', () => { + write(dir, 'src/api/handler.py'); + const spec = { + project: {name: 'x', language: 'python'}, + features: EIGHT_FEATURES, + architecture: {layers: [{name: 'api', modules: []}, {name: 'domain'}]}, + } as never; + expect(scanPatterns(spec, dir)).toEqual(['src/api/**/*.py', 'src/domain/**/*.py']); + }); }); // ─── end-to-end: the universe reaches real findings ─── -/** An inline spec with `count` features, the given layers, and an optional claim. */ -function inlineSpec(language: string, layers: string[], modules: string[] = []): string { +/** + * One declared layer: a bare name (canonical tier form) or the object form + * carrying its own `modules` globs. + */ +type LayerDecl = string | {readonly name: string; readonly modules: readonly string[]}; + +/** Renders `architecture.layers`: bare names share one tier, object layers stand alone. */ +function layerLines(layers: readonly LayerDecl[]): string[] { + const bare = layers.filter((l): l is string => typeof l === 'string'); + const lines = bare.length > 0 ? [` - [${bare.join(', ')}]`] : []; + for (const layer of layers) { + if (typeof layer === 'string') continue; + lines.push(` - name: ${layer.name}`); + lines.push(` modules: [${layer.modules.map((g) => `"${g}"`).join(', ')}]`); + } + return lines; +} + +/** An inline spec with `featureCount` features, the given layers, and an optional claim. */ +function inlineSpec( + language: string, + layers: readonly LayerDecl[], + modules: string[] = [], + featureCount = 8, +): string { return ( [ 'schema: "0.1"', `project: {name: f, language: ${language}}`, 'architecture:', ' layers:', - ` - [${layers.join(', ')}]`, + ...layerLines(layers), 'features:', - ...Array.from({length: 8}, (_, i) => + ...Array.from({length: featureCount}, (_, i) => [ ` - id: F-10000${i}`, ' title: t', @@ -380,4 +472,121 @@ describe('UNMAPPED_ARTIFACT — declared layers reach real files', () => { const findings = unmappedArtifact.run({cwd: dir}); expect(findings.map((f) => f.path)).toEqual(['src/main/kotlin/core/Orphan.kt']); }); + + test('AC-96ff696f — a layer named for a concept, not a directory, is scanned where its glob points', () => { + // Defect D1, measured through the shipped binary: two specs identical + // but for the layer name — `core` (a real segment) reported 21 unclaimed + // files, `native` reported 0, though the declared glob never moved. + write(dir, 'core/src/main/cpp/claimed.cpp', 'int claimed() { return 1; }\n'); + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + write(dir, 'core/src/main/cpp/util/helper.h', '#pragma once\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec( + 'cpp', + [{name: 'native', modules: ['core/src/main/cpp/**']}], + ['core/src/main/cpp/claimed.cpp'], + ), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.map((f) => f.path).sort()).toEqual([ + 'core/src/main/cpp/orphan.cpp', + 'core/src/main/cpp/util/helper.h', + ]); + for (const f of findings) expect(f.severity).toBe('error'); + }); + + test('AC-96ff696f — a declared glob without a trailing wildcard reaches the same files', () => { + write(dir, 'core/src/main/cpp/claimed.cpp', 'int claimed() { return 1; }\n'); + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec( + 'cpp', + [{name: 'native', modules: ['core/src/main/cpp']}], + ['core/src/main/cpp/claimed.cpp'], + ), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.map((f) => f.path)).toEqual(['core/src/main/cpp/orphan.cpp']); + expect(findings[0].severity).toBe('error'); + }); + + test('AC-96ff696f — a glob layer and a bare layer both contribute findings', () => { + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + write(dir, 'src/router/orphan.ts', 'export const x = 1;\n'); + write(dir, 'src/router/claimed.ts', 'export const y = 1;\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec( + 'cpp', + ['router', {name: 'native', modules: ['core/src/main/cpp/**']}], + ['src/router/claimed.ts'], + ), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.map((f) => f.path).sort()).toEqual([ + 'core/src/main/cpp/orphan.cpp', + 'src/router/orphan.ts', + ]); + for (const f of findings) expect(f.severity).toBe('error'); + }); + + test('AC-e20dbafe — the same tree WITHOUT the glob reports an empty universe instead of silence', () => { + // Name-only `native`: nothing on disk is called that, so the universe + // resolves to `src/native/**` and scans zero files. Pre-fix that was a + // clean bill of health; now it says where it looked. + write(dir, 'core/src/main/cpp/claimed.cpp', 'int claimed() { return 1; }\n'); + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec('cpp', ['native'], ['core/src/main/cpp/claimed.cpp']), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings.filter((f) => f.severity === 'error')).toEqual([]); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('info'); + expect(findings[0].message).toContain('matched no files'); + expect(findings[0].message).toContain('layers {native}'); + expect(findings[0].message).toContain('roots {src}'); + expect(findings[0].message).toContain('declare layer modules globs'); + }); + + test('AC-e20dbafe — a declared glob pointing at a moved tree is reported by its glob', () => { + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec('cpp', [{name: 'native', modules: ['native/src/**']}]), + ); + const findings = unmappedArtifact.run({cwd: dir}); + expect(findings).toHaveLength(1); + expect(findings[0].severity).toBe('info'); + expect(findings[0].message).toContain('roots {native/src/**}'); + // Every layer declared its location, so "declare globs" is not the cure. + expect(findings[0].message).toContain('check the declared layer modules globs'); + }); + + test('AC-e20dbafe — a scan that did match files stays silent when every one is claimed', () => { + write(dir, 'core/src/main/cpp/claimed.cpp', 'int claimed() { return 1; }\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec( + 'cpp', + [{name: 'native', modules: ['core/src/main/cpp/**']}], + ['core/src/main/cpp/claimed.cpp'], + ), + ); + expect(unmappedArtifact.run({cwd: dir})).toEqual([]); + }); + + test('AC-e20dbafe — below the scale gate an empty scan stays silent', () => { + // Day-1 adoption: the legacy narrow pair matches nothing here, and that + // protective silence is the design, not a finding to report. + write(dir, 'core/src/main/cpp/orphan.cpp', 'int orphan() { return 0; }\n'); + writeFileSync( + join(dir, 'spec.yaml'), + inlineSpec('cpp', [{name: 'native', modules: ['core/src/main/cpp/**']}], [], 3), + ); + expect(unmappedArtifact.run({cwd: dir})).toEqual([]); + }); }); diff --git a/tests/stages/unmapped-universe-evidence.test.ts b/tests/stages/unmapped-universe-evidence.test.ts index a54701d8..4730037a 100644 --- a/tests/stages/unmapped-universe-evidence.test.ts +++ b/tests/stages/unmapped-universe-evidence.test.ts @@ -256,3 +256,180 @@ describe('UNMAPPED_ARTIFACT · evidence-derived scan universe (F-87bb7ed3)', () } }); }); + +// --------------------------------------------------------------------------- +// D1 · declared layer globs, and disclosure of an empty full scan. +// Appended blind, from the contract addition only — nothing below was derived +// from the implementation, and nothing above it was modified. +// +// Contract addition under test (given, not read from source): +// A. A layer entry may be an OBJECT — {name, modules: [glob…]}. When a layer +// declares `modules` globs, the files under those globs (with extensions +// evidenced by observation-or-claims) are in the universe EVEN THOUGH the +// layer name is not a path segment anywhere. Unclaimed such files → +// one 'error' finding each. +// B. An empty full-scan universe is DISCLOSED, not silent: a layer with no +// globs whose name matches no directory yields zero 'error' findings and +// exactly one 'info' finding that names the layer. +// +// The base contract's extension rule is relied on unchanged: every extension in +// play below (.cpp/.h/.ts) is a known-language extension observed in the tree, +// so no case here rests on an extension having to be taught by a claim. +// --------------------------------------------------------------------------- + +/** A tier of the architecture.layers sequence: bare names, or one object layer. */ +type DeclaredLayer = string[] | {name: string; modules: string[]}; + +type GlobFixture = { + /** spec.project.language — declared, and per contract inert for the universe. */ + language: string; + /** architecture.layers — each entry is a bare tier or an object layer. */ + layers: DeclaredLayer[]; + /** modules[] per feature; padded to nine features with empty-module entries. */ + claims: string[][]; + /** source files to materialise, repo-relative. */ + files: string[]; +}; + +/** architecture.layers block where a tier may be a bare list OR an object layer. */ +function declaredLayerBlock(layers: DeclaredLayer[]): string[] { + const lines: string[] = []; + for (const tier of layers) { + if (Array.isArray(tier)) { + for (const [index, name] of tier.entries()) { + lines.push(index === 0 ? ` - - ${name}` : ` - ${name}`); + } + continue; + } + lines.push(` - name: ${tier.name}`); + lines.push(` modules: [${tier.modules.map(glob => `"${glob}"`).join(', ')}]`); + } + return lines; +} + +function makeGlobFixture(fixture: GlobFixture): string { + const dir = mkdtempSync(join(tmpdir(), 'clad-unmapped-globlayer-')); + scratch.push(dir); + mkdirSync(join(dir, 'spec', 'features'), {recursive: true}); + + const featureCount = Math.max(9, fixture.claims.length); + const featureBlocks: string[] = []; + for (let i = 0; i < featureCount; i++) { + const modules = fixture.claims[i] ?? []; + const id = `F-a${String(i + 1).padStart(7, '0')}`; + const lines = [` - id: ${id}`, ' title: t', ' status: done']; + if (modules.length === 0) { + lines.push(' modules: []'); + } else { + lines.push(' modules:'); + for (const module of modules) lines.push(` - "${module}"`); + } + featureBlocks.push(lines.join('\n')); + } + + const yaml = [ + 'schema: "0.1"', + 'project:', + ' name: x', + ` language: ${fixture.language}`, + 'architecture:', + ' layers:', + ...declaredLayerBlock(fixture.layers), + 'features:', + ...featureBlocks, + '', + ].join('\n'); + writeFileSync(join(dir, 'spec.yaml'), yaml, 'utf8'); + + for (const rel of fixture.files) { + const abs = join(dir, rel); + mkdirSync(dirname(abs), {recursive: true}); + writeFileSync(abs, '// x\n', 'utf8'); + } + + return dir; +} + +/** Runs the detector on a possibly-object-layer spec, enforcing finding identity. */ +function scanDeclared(fixture: GlobFixture): Finding[] { + const findings = unmappedArtifact.run({cwd: makeGlobFixture(fixture)}) as Finding[]; + expect(Array.isArray(findings)).toBe(true); + for (const finding of findings) { + expect(finding.detector).toBe('UNMAPPED_ARTIFACT'); + expect(typeof finding.message).toBe('string'); + expect(finding.message.length).toBeGreaterThan(0); + } + return findings; +} + +function withSeverity(findings: Finding[], severity: string): Finding[] { + return findings.filter(finding => finding.severity === severity); +} + +/** Severity + path of every finding, sorted — the full identity of a verdict. */ +function severityPathSignature(findings: Finding[]): string[] { + return findings + .map(finding => `${finding.severity} ${(finding.path ?? '').replace(/\\/g, '/').replace(/^\.\//, '')}`) + .sort(); +} + +/** Case A's tree: a layer named 'native' that exists only as a declared glob. */ +function globLayerFixture(language: string, glob = 'engine/src/**'): GlobFixture { + return { + language, + layers: [{name: 'native', modules: [glob]}], + claims: [['engine/src/a.cpp']], + files: ['engine/src/a.cpp', 'engine/src/b.cpp', 'engine/src/c.h'], + }; +} + +describe('UNMAPPED_ARTIFACT · declared layer globs and empty-scan disclosure (F-87bb7ed3 D1)', () => { + it('scans a layer’s declared globs though the layer name is nowhere in the tree', () => { + const findings = scanDeclared(globLayerFixture('cpp')); + + expectExactly(withSeverity(findings, 'error'), ['engine/src/b.cpp', 'engine/src/c.h']); + expect(reported(withSeverity(findings, 'error')), said(findings)).not.toContain('engine/src/a.cpp'); + }); + + it('reads a declared glob without a trailing wildcard as the same subtree', () => { + const findings = scanDeclared(globLayerFixture('cpp', 'engine/src')); + + expectExactly(withSeverity(findings, 'error'), ['engine/src/b.cpp', 'engine/src/c.h']); + }); + + it('discloses an empty full scan instead of passing a tree it never looked at', () => { + // 'native' declares no globs and matches no directory, so the scan universe + // is empty. Silence would read as "clean"; the contract demands disclosure. + const findings = scanDeclared({ + language: 'cpp', + layers: [['native']], + claims: [['engine/src/a.cpp']], + files: ['engine/src/a.cpp', 'engine/src/b.cpp'], + }); + + expect(withSeverity(findings, 'error'), said(findings)).toHaveLength(0); + + const infos = withSeverity(findings, 'info'); + expect(infos, said(findings)).toHaveLength(1); + expect(infos[0]?.message.toLowerCase(), said(findings)).toContain('native'); + }); + + it('scans a declared-glob layer and a bare tier in the same spec', () => { + const findings = scanDeclared({ + language: 'cpp', + layers: [{name: 'native', modules: ['engine/src/**']}, ['core']], + claims: [['engine/src/a.cpp', 'src/core/x.ts']], + files: ['engine/src/a.cpp', 'engine/src/b.cpp', 'src/core/x.ts', 'src/core/y.ts'], + }); + + expectExactly(withSeverity(findings, 'error'), ['engine/src/b.cpp', 'src/core/y.ts']); + }); + + it('ignores the declared language label for glob-declared layers too', () => { + const asCpp = scanDeclared(globLayerFixture('cpp')); + const asJava = scanDeclared(globLayerFixture('java')); + + expectExactly(withSeverity(asJava, 'error'), ['engine/src/b.cpp', 'engine/src/c.h']); + expect(severityPathSignature(asJava), said(asJava)).toEqual(severityPathSignature(asCpp)); + }); +}); From 131dbc50ed46d22e85a40fd94c936babd9603c33 Mon Sep 17 00:00:00 2001 From: qwerfunch Date: Wed, 26 Aug 2026 15:59:27 +0900 Subject: [PATCH 6/6] test(conformance): align the language-mismatch fixture with the evidence contract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The F-013 fixture encoded the manifest-chain comparison (one .ts file, python declared, warn expected from the toolchain verdict). Under the evidence model one classified file sits below the floor, so the fixture went silent and CI's stage-contract corpus caught it — the corpus doing its job on a semantics change. The fixture now clears the floor with five observed sources, and F-013's criterion text plus the corpus description state the current contract, with the evidence model owned by the new spec entry. Conformance corpus 33/33 matched, Iron Law L4, full suite 2953/2953. Co-Authored-By: Claude Opus 5 --- conformance/fixtures.yaml | 2 +- conformance/runner.ts | 25 +++++++++++++++---------- spec/attestation.yaml | 4 ++-- spec/features/F-013.yaml | 14 +++++++++----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/conformance/fixtures.yaml b/conformance/fixtures.yaml index 5b714c79..d84c580b 100644 --- a/conformance/fixtures.yaml +++ b/conformance/fixtures.yaml @@ -175,7 +175,7 @@ fixtures: - name: F-013_AC-021 stage: documentary kind: runnable - description: "F-013/AC-021 — When spec.project.language differs from the language resolved by the toolchain manifest chain, the detector shall emit a warn-severity finding." + description: "F-013/AC-021 — When the declared language is absent from the observed sources with at least five classified files, the detector shall emit a warn-severity finding naming the observed distribution (evidence-based since F-9e1279d4; the manifest chain is no longer consulted for identity)." - name: F-014_AC-022 stage: documentary kind: runnable diff --git a/conformance/runner.ts b/conformance/runner.ts index b3fb50f6..0ae9325e 100644 --- a/conformance/runner.ts +++ b/conformance/runner.ts @@ -647,22 +647,27 @@ const fixtures: readonly Fixture[] = [ }, { // F-013/AC-021 — TECH_STACK_MISMATCH warn when spec.project.language - // differs from what the toolchain detection chain returns. The warn + // is absent from the OBSERVED SOURCES (evidence-based since + // F-9e1279d4 — the manifest chain is no longer consulted for + // identity). Five .ts files clear the evidence floor (5), python is + // absent from the observed set, so exactly one warn fires. The warn // does not fail drift (default severity is warn, not error), so // pass remains true; the assertion is on the finding shape. // - // The fixture writes `.secretlintrc.json` because adding package.json - // makes the toolchain pick TypeScript, which makes HARDCODED_SECRET - // try to invoke secretlint via npx — without a config file the - // scanner exits non-zero and emits an error finding that would mask - // the warn we are actually probing for. + // The fixture writes `.secretlintrc.json` because package.json makes + // the toolchain pick TypeScript for GATE COMMANDS, which makes + // HARDCODED_SECRET try to invoke secretlint via npx — without a + // config file the scanner exits non-zero and emits an error finding + // that would mask the warn we are actually probing for. id: 'F-013_AC-021', stage: 'stage_1.3', expectedPass: true, setup(d) { mkdirSync(join(d, 'stages'), {recursive: true}); mkdirSync(join(d, 'spec'), {recursive: true}); - writeTs(d, 'stages/dummy.ts', '// fixture stub\nexport const ok = true;\n'); + for (let i = 1; i <= 5; i++) { + writeTs(d, `stages/dummy${i}.ts`, '// fixture stub\nexport const ok = true;\n'); + } writeFileSync(join(d, 'package.json'), PKG_JSON); writeFileSync(join(d, '.secretlintrc.json'), SECRETLINTRC); writeFileSync( @@ -672,8 +677,8 @@ const fixtures: readonly Fixture[] = [ properties: {schema: {}, project: {}, features: {}}, }), ); - // spec.project.language = python, but package.json + .ts source - // make the toolchain resolve to typescript → mismatch. + // spec.project.language = python, but five observed .ts sources + // put python absent from the evidence → warn (F-9e1279d4 contract). writeFileSync( join(d, 'spec.yaml'), 'schema: "0.1"\n' + @@ -682,7 +687,7 @@ const fixtures: readonly Fixture[] = [ ' - id: F-001\n' + ' title: t\n' + ' status: done\n' + - ' modules: [stages/dummy.ts, spec/schema.json]\n' + + ' modules: [stages/dummy1.ts, stages/dummy2.ts, stages/dummy3.ts, stages/dummy4.ts, stages/dummy5.ts, spec/schema.json]\n' + ' acceptance_criteria:\n' + ' - id: AC-001\n' + ' ears: ubiquitous\n' + diff --git a/spec/attestation.yaml b/spec/attestation.yaml index 0c0c4150..38cd28e2 100644 --- a/spec/attestation.yaml +++ b/spec/attestation.yaml @@ -34,8 +34,8 @@ attested_modules: README.zh.md: c7ac2cfce5153064 SECURITY.md: df1d0c80304b2f28 bin/clad: 77b80666665dd1b0 - conformance/fixtures.yaml: 4b1b94dae1cd20b0 - conformance/runner.ts: b9c9e71df85d382e + conformance/fixtures.yaml: 5b461bb43a79a983 + conformance/runner.ts: 5e638e070dbb10c2 docs/README.md: 5672e5726104d845 docs/ab-evaluation-extended/README.md: f690562df2e5ec06 docs/ab-evaluation-extended/scenarios/dashboard/report.md: a656cad8c8ac2772 diff --git a/spec/features/F-013.yaml b/spec/features/F-013.yaml index 29b51abc..0d915546 100644 --- a/spec/features/F-013.yaml +++ b/spec/features/F-013.yaml @@ -10,9 +10,13 @@ depends_on: acceptance_criteria: - id: AC-021 ears: event - condition: when spec.project.language differs from the toolchain-detected language - 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. + condition: when the declared spec.project.language is absent from the observed + sources with at least five classified files + action: emit a warn finding naming the observed distribution + response: stage_1.3 surfaces but does not fail on this finding alone; the + evidence model (vocabulary, floor, minority band) is owned by F-9e1279d4 + text: When the declared language is absent from the observed source set with + at least five classified files, the detector shall emit a warn-severity + finding naming the observed distribution (amended 2026-08-26 — the manifest + chain is no longer consulted for identity). evidence_refs: [fixture:F-013_AC-021]